This commit is contained in:
2019-10-23 18:00:57 +00:00
parent 69aeb111df
commit a8dbd7106a
3 changed files with 34 additions and 10 deletions

View File

@@ -594,6 +594,25 @@ namespace raven_integration
[Fact]
public async void CustomFieldSearchShouldWork()
{
/*
Failing on huge data test after many hours:
[xUnit.net 00:00:21.49] raven_integration.SearchOps.CustomFieldSearchShouldWork [FAIL]
X raven_integration.SearchOps.CustomFieldSearchShouldWork [1s 84ms]
Error Message:
Expected MatchingIdList {109274L, 109095L, 108919L, 108740L, 108558L, 108382L, 108201L, 108021L, 107842L, 107663L, 107487L, 107305L, 107126L, 106947L, 106768L, 106589L, 106413L, 106233L, 106052L, 105873L, 105692L, 105510L, 105341L, 105157L, 104978L, 104799L, 104620L, 104441L, 104262L, 104084L, 103906L, 103725L, .468 more.} to contain 195378L because ShouldContainMatchingCustomFieldWidgetId.
Stack Trace:
at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message)
at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
at FluentAssertions.Collections.SelfReferencingCollectionAssertions`2.Contain(T expected, String because, Object[] becauseArgs)
at raven_integration.SearchOps.CustomFieldSearchShouldWork() in c:\data\code\raven-test-integration\Search\SearchOps.cs:line 644
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
Likely fix is to force order to most recent or simply to delete after test so they don't build up into a huge list
*/
//CREATE CUSTOM FIELD DATA TO SEARCH FOR (note must use already defined template so c2 is the text one)
dynamic dCustomField = new JObject();
@@ -631,9 +650,7 @@ namespace raven_integration
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(1);//might be a successive run and still have some left so account for more than one return
//Turn the list into an array of id's
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
// v.Count.Should().Be(1);
// v[0]["id"].Value<long>().Should().Be(MatchingWidgetId);
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
List<long> MatchingIdList = new List<long>();
foreach (JObject j in v)
{
@@ -643,6 +660,11 @@ namespace raven_integration
//Ensure the expected items are returned
MatchingIdList.Should().Contain(MatchingWidgetId, "ShouldContainMatchingCustomFieldWidgetId");
//Now delete the newly created one so the list doesn't build up and prevent this test from working in big runs...
//DELETE
ApiResponse DELETETestResponse = await Util.DeleteAsync("Widget/" + MatchingWidgetId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
}//eot
//==================================================