diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java index 9ffe6661eab..38dca6bae5b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java @@ -36,6 +36,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import static org.awaitility.Awaitility.await; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.*; @@ -471,6 +472,9 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test { assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.getCode()); assertEquals("In-memory", tag.getDisplay()); + // Wait for subscription to be moved to active + await().until(()-> Subscription.SubscriptionStatus.ACTIVE.equals(ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus())); + Subscription subscriptionActivated = ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute(); assertEquals(Subscription.SubscriptionStatus.ACTIVE, subscriptionActivated.getStatus()); tags = subscriptionActivated.getMeta().getTag(); @@ -495,6 +499,9 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test { assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.getCode()); assertEquals("Database", tag.getDisplay()); + // Wait for subscription to be moved to active + await().until(()-> Subscription.SubscriptionStatus.ACTIVE.equals(ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus())); + Subscription subscription = ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute(); assertEquals(Subscription.SubscriptionStatus.ACTIVE, subscription.getStatus()); tags = subscription.getMeta().getTag();