Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 4aa8e6e

Browse files
authored
Merge pull request #331 from launchdarkly/eb/sc-157098/flaky-tests-2
make LDEndToEndClientTest.test____SpecialHttpConfigurations less timing-sensitive
2 parents 81c04b1 + 96d1db2 commit 4aa8e6e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/test/java/com/launchdarkly/sdk/server/LDClientEndToEndTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ public void testPollingModeSpecialHttpConfigurations() throws Exception {
123123
new LDConfig.Builder()
124124
.dataSource(Components.pollingDataSource().baseURI(serverUri))
125125
.events(noEvents())
126-
.http(httpConfig)
127-
.startWait(Duration.ofMillis(100))
128-
.build());
126+
.http(httpConfig));
129127
}
130128

131129
@Test
@@ -208,9 +206,7 @@ public void testStreamingModeSpecialHttpConfigurations() throws Exception {
208206
new LDConfig.Builder()
209207
.dataSource(Components.streamingDataSource().baseURI(serverUri))
210208
.events(noEvents())
211-
.http(httpConfig)
212-
.startWait(Duration.ofMillis(100))
213-
.build());
209+
.http(httpConfig));
214210
}
215211

216212
@Test
@@ -254,17 +250,21 @@ public void clientSendsDiagnosticEvent() throws Exception {
254250
}
255251

256252
private static void testWithSpecialHttpConfigurations(Handler handler,
257-
BiFunction<URI, HttpConfigurationFactory, LDConfig> makeConfig) throws Exception {
253+
BiFunction<URI, HttpConfigurationFactory, LDConfig.Builder> makeConfig) throws Exception {
258254
TestHttpUtil.testWithSpecialHttpConfigurations(handler,
259255
(serverUri, httpConfig) -> {
260-
LDConfig config = makeConfig.apply(serverUri, httpConfig);
256+
LDConfig config = makeConfig.apply(serverUri, httpConfig)
257+
.startWait(Duration.ofSeconds(10)) // allow extra time to be sure it can connect
258+
.build();
261259
try (LDClient client = new LDClient(sdkKey, config)) {
262260
assertTrue(client.isInitialized());
263261
assertTrue(client.boolVariation(flagKey, user, false));
264262
}
265263
},
266264
(serverUri, httpConfig) -> {
267-
LDConfig config = makeConfig.apply(serverUri, httpConfig);
265+
LDConfig config = makeConfig.apply(serverUri, httpConfig)
266+
.startWait(Duration.ofMillis(100)) // don't wait terribly long when we don't expect it to succeed
267+
.build();
268268
try (LDClient client = new LDClient(sdkKey, config)) {
269269
assertFalse(client.isInitialized());
270270
}

0 commit comments

Comments
 (0)