public async Task ReadNoTable()
        {
            var        table  = GetNewLoggingTable();
            ILogReader reader = LogFactory.NewReader(table);

            Assert.False(table.Exists());

            var segmentDef = await reader.GetFunctionDefinitionsAsync(null);

            Assert.Equal(0, segmentDef.Results.Length);

            var segmentTimeline = await reader.GetActiveContainerTimelineAsync(DateTime.MinValue, DateTime.MaxValue, null);

            Assert.Equal(0, segmentTimeline.Results.Length);

            var segmentRecent = await reader.GetRecentFunctionInstancesAsync(new RecentFunctionQuery
            {
                FunctionName   = "abc",
                Start          = DateTime.MinValue,
                End            = DateTime.MaxValue,
                MaximumResults = 1000
            }, null);

            Assert.Equal(0, segmentRecent.Results.Length);

            var item = await reader.LookupFunctionInstanceAsync(Guid.NewGuid());

            Assert.Null(item);
        }
        public async Task ReadNoTable()
        {
            ILogReader reader = LogFactory.NewReader(this);

            Assert.Empty(_tables); // no tables yet.

            var segmentDef = await reader.GetFunctionDefinitionsAsync(null, null);

            Assert.Empty(segmentDef.Results);

            var segmentTimeline = await reader.GetActiveContainerTimelineAsync(DateTime.MinValue, DateTime.MaxValue, null);

            Assert.Empty(segmentTimeline.Results);

            var segmentRecent = await reader.GetRecentFunctionInstancesAsync(new RecentFunctionQuery
            {
                FunctionId     = FunctionId.Parse("abc"),
                Start          = DateTime.MinValue,
                End            = DateTime.MaxValue,
                MaximumResults = 1000
            }, null);

            Assert.Empty(segmentRecent.Results);

            var item = await reader.LookupFunctionInstanceAsync(Guid.NewGuid());

            Assert.Null(item);
        }
Exemple #3
0
        public async Task <IHttpActionResult> GetContainerTimeline(
            [FromUri] PagingInfo pagingInfo,
            DateTime?start = null,
            DateTime?end   = null)
        {
            if (end == null)
            {
                end = DateTime.UtcNow;
            }
            if (start == null)
            {
                start = end.Value.AddDays(-7);
            }
            if (pagingInfo == null)
            {
                return(BadRequest());
            }

            var segment = await _reader.GetActiveContainerTimelineAsync(start.Value, end.Value, null);

            return(Ok(segment));
        }