Skip to content

Commit d8ea3ae

Browse files
committed
fix unstable tests
1 parent 403b325 commit d8ea3ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/config/AdminServerNotifierAutoConfigurationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,18 @@ public void close() {
6363
}
6464

6565
@Test
66-
public void test_notifierListener() {
66+
public void test_notifierListener() throws InterruptedException {
6767
load(TestSingleNotifierConfig.class);
6868
InstanceEventStore store = context.getBean(InstanceEventStore.class);
6969

7070
StepVerifier.create(store)
7171
.expectSubscription()
7272
.then(() -> StepVerifier.create(store.append(Collections.singletonList(APP_DOWN))).verifyComplete())
7373
.expectNext(APP_DOWN)
74-
.then(() -> assertThat(context.getBean(TestNotifier.class).getEvents()).containsOnly(APP_DOWN))
7574
.thenCancel()
7675
.verify();
76+
Thread.sleep(50); //wait for the notifications in different thread
77+
assertThat(context.getBean(TestNotifier.class).getEvents()).containsOnly(APP_DOWN);
7778
}
7879

7980
@Test
@@ -163,7 +164,6 @@ public static class TestSingleNotifierConfig {
163164
public Notifier testNotifier() {
164165
return new TestNotifier();
165166
}
166-
167167
}
168168

169169
private static class MailSenderConfig {

0 commit comments

Comments
 (0)