Skip to content

Commit 9a32b22

Browse files
committed
increase sleep to "fix" flaky tests
Signed-off-by: christian.lutnik <[email protected]>
1 parent 97bdaba commit 9a32b22

File tree

1 file changed

+9
-11
lines changed
  • providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps

1 file changed

+9
-11
lines changed

providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps/ProviderSteps.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public static void afterAll() throws IOException {
5353
}
5454

5555
@Before
56-
public void before() throws IOException {
56+
public void before() {
5757
if (!container.isRunning()) {
5858
container.start();
5959
}
6060
}
6161

6262
@After
63-
public void tearDown() throws InterruptedException {
63+
public void tearDown() {
6464
if (state.client != null) {
6565
when().post("http://" + container.getLaunchpadUrl() + "/stop")
6666
.then()
@@ -70,7 +70,7 @@ public void tearDown() throws InterruptedException {
7070
}
7171

7272
@Given("a {} flagd provider")
73-
public void setupProvider(String providerType) throws IOException, InterruptedException {
73+
public void setupProvider(String providerType) throws InterruptedException {
7474
String flagdConfig = "default";
7575
state.builder.deadline(1000).keepAlive(0).retryGracePeriod(2);
7676
boolean wait = true;
@@ -125,28 +125,26 @@ public void setupProvider(String providerType) throws IOException, InterruptedEx
125125
.statusCode(200);
126126

127127
// giving flagd a little time to start
128-
Thread.sleep(30);
128+
Thread.sleep(100);
129129
FeatureProvider provider =
130130
new FlagdProvider(state.builder.resolverType(State.resolverType).build());
131131

132132
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
133-
String providerName = providerType + Math.random();
134133
if (wait) {
135-
api.setProviderAndWait(providerName, provider);
134+
api.setProviderAndWait(provider);
136135
} else {
137-
api.setProvider(providerName, provider);
136+
api.setProvider(provider);
138137
}
139-
log.info("provider name: {}", providerName);
140-
this.state.client = api.getClient(providerName);
138+
this.state.client = api.getClient();
141139
}
142140

143141
@When("the connection is lost")
144-
public void the_connection_is_lost() throws InterruptedException {
142+
public void the_connection_is_lost() {
145143
when().post("http://" + container.getLaunchpadUrl() + "/stop").then().statusCode(200);
146144
}
147145

148146
@When("the connection is lost for {int}s")
149-
public void the_connection_is_lost_for(int seconds) throws InterruptedException {
147+
public void the_connection_is_lost_for(int seconds) {
150148
when().post("http://" + container.getLaunchpadUrl() + "/restart?seconds={seconds}", seconds)
151149
.then()
152150
.statusCode(200);

0 commit comments

Comments
 (0)