Skip to content

Commit

Permalink
ci: simplifying test to remove race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
tanderson-ld committed Mar 14, 2024
1 parent e12f907 commit 6559060
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,14 @@ public void testEventContainsAutoEnvAttributesWhenEnabled() throws Exception {
.diagnosticOptOut(true)
.serviceEndpoints(Components.serviceEndpoints()
.events(baseUrl.uri())
.streaming(baseUrl.uri())
.polling(baseUrl.uri())
)
.build();

try (LDClient ldClient = LDClient.init(application, ldConfig, ldContext, 0)){
ldClient.boolVariation("this-flag-doesnt-exist", false);
ldClient.blockingFlush();

LDValue[] events = getEventsFromLastRequest(mockEventsServer, 2);
LDValue identifyEvent = events[0], summaryEvent = events[1];
LDValue[] events = getEventsFromLastRequest(mockEventsServer, 1);
LDValue identifyEvent = events[0];
assertTrue(identifyEvent.get("context").toString().contains("ld_application"));
assertTrue(identifyEvent.get("context").toString().contains("ld_device"));
}
Expand All @@ -287,17 +284,14 @@ public void testEventDoesNotContainAutoEnvAttributesWhenDisabled() throws Except
.diagnosticOptOut(true)
.serviceEndpoints(Components.serviceEndpoints()
.events(baseUrl.uri())
.streaming(baseUrl.uri())
.polling(baseUrl.uri())
)
.build();

try (LDClient ldClient = LDClient.init(application, ldConfig, ldContext, 0)){
ldClient.boolVariation("this-flag-doesnt-exist", false);
ldClient.blockingFlush();

LDValue[] events = getEventsFromLastRequest(mockEventsServer, 2);
LDValue identifyEvent = events[0], summaryEvent = events[1];
LDValue[] events = getEventsFromLastRequest(mockEventsServer, 1);
LDValue identifyEvent = events[0];
assertFalse(identifyEvent.get("context").toString().contains("ld_application"));
assertFalse(identifyEvent.get("context").toString().contains("ld_device"));
}
Expand Down

0 comments on commit 6559060

Please sign in to comment.