using System; using Xunit; using Newtonsoft.Json.Linq; using FluentAssertions; using System.Collections.Generic; using System.Collections.Concurrent; namespace raven_integration { public class Metrics { /// /// /// [Fact] public async void MetricsShouldFetch() { // DateTime tsEnd = DateTime.Now.ToOffsetAdjustedUniversalTime();//{2020-05-29 3:30:21 PM} // DateTime tsStart = DateTime.Now.AddHours(-6).ToOffsetAdjustedUniversalTime();//{2020-05-29 9:30:21 AM} // DateTime tsEnd = DateTime.UtcNow;//{2020-05-29 3:32:54 PM} // DateTime tsStart = DateTime.UtcNow.AddHours(-6); //{2020-05-29 9:32:54 AM} //weirdly, this is the only way to get the correct date range //just as the html client does but from here //in both cases the server shows parameters as local time to the server //and in the route I have to adjust them back to universal time before sending them to the db query //as the db data is in utc and the db server doesn't know what timezone it is DateTime tsEnd = DateTime.Now;//{2020-05-29 8:36:48 AM} DateTime tsStart = DateTime.Now.AddHours(-6); //{2020-05-29 2:36:48 AM} //http://localhost:7575/api/v8.0/server-metric/mm?maxRecords=200&tsStart=2020-05-29T09:23:18.114Z&tsEnd=2020-05-29T15:23:19.114Z //from client at server route {2020-05-29 2:29:25 AM} {2020-05-29 8:29:26 AM} ApiResponse a = await Util.GetAsync($"server-metric/memcpu?tsStart={tsStart}&tsEnd={tsEnd}", await Util.GetTokenAsync("OpsAdminFull")); Util.ValidateDataReturnResponseOk(a); a.ObjectResponse["data"].Should().NotBeNull();//can't get more detailed as there might not be any data here to see a = await Util.GetAsync($"server-metric/storage?tsStart={tsStart}&tsEnd={tsEnd}", await Util.GetTokenAsync("OpsAdminFull")); Util.ValidateDataReturnResponseOk(a); a.ObjectResponse["data"].Should().NotBeNull();//can't get more detailed as there might not be any data here to see } //================================================== }//eoc }//eons