From f0d9c53de6150edbf397153aafa85f2ae13cd8b6 Mon Sep 17 00:00:00 2001 From: Alberto Rios Date: Thu, 16 May 2019 10:29:20 +0200 Subject: [PATCH] Fixing flake when deletion succeeded Sometimes we go from IN_PROGRESS status to SUCCEEDED faster than we pull from the last_operation Since SUCCEEDED is the final expected status, an either was added to consider this scenario --- .../DeleteInstanceWithServicesComponentTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-cloud-app-broker-integration-tests/src/test/java/org.springframework.cloud.appbroker/integration/DeleteInstanceWithServicesComponentTest.java b/spring-cloud-app-broker-integration-tests/src/test/java/org.springframework.cloud.appbroker/integration/DeleteInstanceWithServicesComponentTest.java index a57e0b8..c0a28d6 100644 --- a/spring-cloud-app-broker-integration-tests/src/test/java/org.springframework.cloud.appbroker/integration/DeleteInstanceWithServicesComponentTest.java +++ b/spring-cloud-app-broker-integration-tests/src/test/java/org.springframework.cloud.appbroker/integration/DeleteInstanceWithServicesComponentTest.java @@ -26,6 +26,7 @@ import org.springframework.test.context.TestPropertySource; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.springframework.cloud.appbroker.integration.DeleteInstanceWithServicesComponentTest.APP_NAME; @@ -134,7 +135,10 @@ class DeleteInstanceWithServicesComponentTest extends WiremockComponentTest { .get(brokerFixture.getLastInstanceOperationUrl(), "instance-id") .then() .statusCode(HttpStatus.OK.value()) - .body("state", is(equalTo(OperationState.IN_PROGRESS.toString()))); + .body("state", + either(equalTo(OperationState.IN_PROGRESS.toString())) + // if the error occurs immediately it will return succeeded status + .or(equalTo(OperationState.SUCCEEDED.toString()))); String state = brokerFixture.waitForAsyncOperationComplete("instance-id"); assertThat(state).isEqualTo(OperationState.SUCCEEDED.toString());