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
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user