Commit d8ea3ae4 by Johannes Edmeier

fix unstable tests

parent 403b3258
...@@ -63,7 +63,7 @@ public class AdminServerNotifierAutoConfigurationTest { ...@@ -63,7 +63,7 @@ public class AdminServerNotifierAutoConfigurationTest {
} }
@Test @Test
public void test_notifierListener() { public void test_notifierListener() throws InterruptedException {
load(TestSingleNotifierConfig.class); load(TestSingleNotifierConfig.class);
InstanceEventStore store = context.getBean(InstanceEventStore.class); InstanceEventStore store = context.getBean(InstanceEventStore.class);
...@@ -71,9 +71,10 @@ public class AdminServerNotifierAutoConfigurationTest { ...@@ -71,9 +71,10 @@ public class AdminServerNotifierAutoConfigurationTest {
.expectSubscription() .expectSubscription()
.then(() -> StepVerifier.create(store.append(Collections.singletonList(APP_DOWN))).verifyComplete()) .then(() -> StepVerifier.create(store.append(Collections.singletonList(APP_DOWN))).verifyComplete())
.expectNext(APP_DOWN) .expectNext(APP_DOWN)
.then(() -> assertThat(context.getBean(TestNotifier.class).getEvents()).containsOnly(APP_DOWN))
.thenCancel() .thenCancel()
.verify(); .verify();
Thread.sleep(50); //wait for the notifications in different thread
assertThat(context.getBean(TestNotifier.class).getEvents()).containsOnly(APP_DOWN);
} }
@Test @Test
...@@ -163,7 +164,6 @@ public class AdminServerNotifierAutoConfigurationTest { ...@@ -163,7 +164,6 @@ public class AdminServerNotifierAutoConfigurationTest {
public Notifier testNotifier() { public Notifier testNotifier() {
return new TestNotifier(); return new TestNotifier();
} }
} }
private static class MailSenderConfig { private static class MailSenderConfig {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment