From 56c7b8a1be7995bfdc972a018ee2ef5402e088d2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 7 Dec 2018 21:10:19 +0000 Subject: [PATCH] --- devdocs/todo.txt | 149 +++++++++++++++++- .../AyaNova/Controllers/ApiRootController.cs | 5 +- server/AyaNova/Startup.cs | 2 +- .../AyaNova/biz/FilterSqlCriteriaBuilder.cs | 2 +- test/raven-integration/util.cs | 4 +- 5 files changed, 153 insertions(+), 9 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 4253256c..913ce9a8 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -5,16 +5,157 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQyNjY5Njc3IiwiZXhwIjoi ## IMMEDIATE ITEMS +See below todo to figure out what is wrong with the filter query next month (for starters) +It's nothing obvious that's for sure. + +================== DEVOPS - PUT UP A DEVOPS COPY AFTER THE ABOVE IS DONE AND RUN ALL UNIT TESTS TO CONFIRM DATE FILTER COD +FIRST RUN WITH HUGE DATASET LOG: +Starting extension +Finding projects for pattern c:/data\code\raven\test\raven-integration/ +Found 1 matches for pattern in folder c:\data\code\raven\test\raven-integration +Evaluating match c:/data/code/raven/test/raven-integration/ +Adding directory c:/data/code/raven/test/raven-integration/ +Executing dotnet test -t -v=q in c:/data/code/raven/test/raven-integration/ +Discoverd tests with xunit. Found 135 in 1 directories +Executing dotnet build in c:/data/code/raven/test/raven-integration/ +Executing dotnet test --no-build --logger "trx;LogFileName=C:\Users\John\AppData\Local\Temp\test-explorer\0.trx" in c:/data/code/raven/test/raven-integration/ +Process 12920 started +Test run for c:\data\code\raven\test\raven-integration\bin\Debug\netcoreapp2.1\raven-integration.dll(.NETCoreApp,Version=v2.1) +Microsoft (R) Test Execution Command Line Tool Version 15.7.0 +Copyright (c) Microsoft Corporation. All rights reserved. + +Starting test execution, please wait... +Failed raven_integration.DataFilterFilteringLists.TextOpNotEqualFilterWorks +Error Message: + Expected InclusiveMatchCount to be 2, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.Be(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 49 + at raven_integration.DataFilterFilteringLists.TextOpNotEqualFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 5162 +Failed raven_integration.DataFilterFilteringLists.DecimalNotEqualToFilterWorks +Error Message: + Expected InclusiveMatchCount to be greater or equal to 1, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterOrEqualTo(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 239 + at raven_integration.DataFilterFilteringLists.DecimalNotEqualToFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 7142 +Failed raven_integration.DataFilterFilteringLists.DateOpNotEqualToFilterWorks +Error Message: + Expected InclusiveMatchCount to be greater or equal to 1, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterOrEqualTo(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 239 + at raven_integration.DataFilterFilteringLists.DateOpNotEqualToFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 694 +Failed raven_integration.DataFilterFilteringLists.TextOpLessThanOrEqualToFilterWorks +Error Message: + Expected InclusiveMatchCount to be 2, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.Be(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 49 + at raven_integration.DataFilterFilteringLists.TextOpLessThanOrEqualToFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 5041 +Failed raven_integration.DataFilterFilteringLists.IntegerOpLessThanFilterWorks +Error Message: + Expected InclusiveMatchCount to be greater or equal to 1, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterOrEqualTo(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 239 + at raven_integration.DataFilterFilteringLists.IntegerOpLessThanFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 6068 +Failed raven_integration.DataFilterFilteringLists.IntegerNotEqualToFilterWorks +Error Message: + Expected InclusiveMatchCount to be greater or equal to 1, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterOrEqualTo(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 239 + at raven_integration.DataFilterFilteringLists.IntegerNotEqualToFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 6271 +Failed raven_integration.DataFilterFilteringLists.DecimalOpLessThanFilterWorks +Error Message: + Expected InclusiveMatchCount to be greater or equal to 1, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterOrEqualTo(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 239 + at raven_integration.DataFilterFilteringLists.DecimalOpLessThanFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 6939 +Failed raven_integration.DataFilterFilteringLists.DateTokenInTheLast3MonthsFilterWorks +Error Message: + Expected ((JArray)a.ObjectResponse["data"]).Count to be greater than 0, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterThan(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 217 + at raven_integration.DataFilterFilteringLists.DateTokenInTheLast3MonthsFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 2209 +Failed raven_integration.DataFilterFilteringLists.DateTokenInTheLast6MonthsFilterWorks +Error Message: + Expected ((JArray)a.ObjectResponse["data"]).Count to be greater than 0, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterThan(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 217 + at raven_integration.DataFilterFilteringLists.DateTokenInTheLast6MonthsFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 2310 +Failed raven_integration.DataFilterFilteringLists.DateTokenNextMonthFilterWorks +Error Message: + Expected ExclusiveMatchCount to be 0, but found 1. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.Be(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 49 + at raven_integration.DataFilterFilteringLists.DateTokenNextMonthFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 1606 +Failed raven_integration.DataFilterFilteringLists.DateTokenPast90DaysFilterWorks +Error Message: + Expected ((JArray)a.ObjectResponse["data"]).Count to be greater than 0, but found 0. +Stack Trace: + at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32 + at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 215 + at FluentAssertions.Numeric.NumericAssertions`1.BeGreaterThan(T expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Numeric\NumericAssertions.cs:line 217 + at raven_integration.DataFilterFilteringLists.DateTokenPast90DaysFilterWorks() in c:\data\code\raven\test\raven-integration\DataFilter\DataFilterFilteringLists.cs:line 3818 +Results File: C:\Users\John\AppData\Local\Temp\test-explorer\0.trx + +Total tests: 135. Passed: 124. Failed: 11. Skipped: 0. +Test execution time: 53.2319 Seconds + +Process 12920 finished + +=-=-= +WITH SMALL DATASET MANY MORE PASSED EXCEPT THESE: +DateTokenPast90DaysFilterWorks +DateTokenNextMonthFilterWorks +DateTokenInTheLast6MonthsFilterWorks +DateTokenInTheLast3MonthsFilterWorks + +Which failed repeatedly, I wonder if the tests are flawed or there's a weird date issue of some kind? +=-=-=- +Further data: Next Month filter - This is failing at devops only with the exclusive date being the first day of the month -1 seconds as written +However if I back it by 8 hours and 1 second then it passes, which is utc difference (7 hours fails still) +So what appears to be happening is the server at UTC is not correctly building the sql filter dates, Need to log that shit to see what is actually happening + +TODO: +Put a debug log on the FilterSqlCriteriaBuilder to log the input and the output in debug mode so can see what is actually happening +Put it up to the server and check to see what is actually happening +I suspect that the issue is the criteria building code dates are starting out in UTC on devops then are further converted to UTC when building the final sql fragment +and somehow getting fucked in that process even though they should just be staying in the same UTC the whole time. + +Here at this server locally they are starting out in pacific time and then converting to UTC properly, maybe? +- Nope, did a test and it's all good at the server, something else going on + +Will need the debug log of the query built to see what the what next + + +================= - - - - +TESTING TODO - Are all tests viable with a huge dataset, try locally and rejig the tests as necessary to make them work properly with huge data if necessary +TESTING TODO - All date ranges should be on exact boundaries to ensure that all boundary date code in criteria builder is correct +SQL Criteria builder - Should it really be backing off a second for boundary edges? That will mean items that are less than a second but more than zero seconds will +be included whenb they shouldn't. If the sql server has 1 millesecond accuracy then it should be backed off one millisecond surely? INITIAL TESTING NOTES: diff --git a/server/AyaNova/Controllers/ApiRootController.cs b/server/AyaNova/Controllers/ApiRootController.cs index bc51b6bb..21c3a359 100644 --- a/server/AyaNova/Controllers/ApiRootController.cs +++ b/server/AyaNova/Controllers/ApiRootController.cs @@ -53,7 +53,10 @@ namespace AyaNova.Api.Controllers
{AySchema.currentSchema.ToString()}

Server time

{DateUtil.ServerDateTimeString(System.DateTime.UtcNow)}
-
{TimeZoneInfo.Local.Id}
+
{TimeZoneInfo.Local.Id}
+
Test datetime.now to string {System.DateTime.Now.ToString()}
+
Test datetime.UtcNow to string {System.DateTime.UtcNow.ToString()}
+
Test datetime.Now then converted to universaltime then to string {System.DateTime.Now.ToUniversalTime().ToString()}

Server logs

{ServerBootConfig.AYANOVA_LOG_PATH}
diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 736812f4..03b04bb0 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -380,7 +380,7 @@ namespace AyaNova // ******************** TESTING WIPE DB ***************************** // //Set this to true to wipe the db and reinstall a trial license and re-seed the data - var TESTING_REFRESH_DB = true;//############################################################################################# + var TESTING_REFRESH_DB = false;//############################################################################################# #if (DEBUG) //TESTING diff --git a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs index a364e7a9..a134b80e 100644 --- a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs +++ b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs @@ -841,7 +841,7 @@ namespace AyaNova.Biz } private static DateTime MaxMilliseconds(DateTime d) { - if (d.Millisecond == 0) return d; + if (d.Millisecond == 999) return d; return new DateTime(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, 999, DateTimeKind.Utc); } diff --git a/test/raven-integration/util.cs b/test/raven-integration/util.cs index 5f1a3eeb..64e73df1 100644 --- a/test/raven-integration/util.cs +++ b/test/raven-integration/util.cs @@ -12,8 +12,8 @@ namespace raven_integration { private static HttpClient client { get; } = new HttpClient(); - private static string API_BASE_URL = "http://localhost:7575/api/v8.0/"; - // private static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/"; + private static string API_BASE_URL = "http://localhost:7575/api/v8.0/"; + // private static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/"; public static string TEST_DATA_FOLDER = @"..\..\..\testdata\";