Awaiting to avoid flake while deleting SI

This commit is contained in:
Alberto C. Ríos
2024-03-07 11:53:58 +01:00
parent 0b0ecb7472
commit af69f79cd5
5 changed files with 10 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import org.cloudfoundry.operations.services.ServiceInstance;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
class CreateInstanceWithServiceInstanceGuidSuffixTargetAcceptanceTest extends CloudFoundryAcceptanceTest {
@@ -90,7 +91,7 @@ class CreateInstanceWithServiceInstanceGuidSuffixTargetAcceptanceTest extends Cl
deleteServiceInstance(SI_NAME);
// and the backing service is deleted
assertThat(listServiceInstances()).doesNotContain(expectedServiceInstanceName);
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(expectedServiceInstanceName));
}
}

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test;
import static java.util.Collections.emptyMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
class CreateInstanceWithServicesAcceptanceTest extends CloudFoundryAcceptanceTest {
@@ -91,8 +92,8 @@ class CreateInstanceWithServicesAcceptanceTest extends CloudFoundryAcceptanceTes
deleteServiceInstance(SI_NAME);
// and the backing services are deleted
assertThat(listServiceInstances()).doesNotContain(BACKING_SI_1_NAME);
assertThat(listServiceInstances()).doesNotContain(BACKING_SI_2_NAME);
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(BACKING_SI_1_NAME));
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(BACKING_SI_2_NAME));
// TODO: another story to only remove the instances with service definition specified (https://github.com/spring-cloud/spring-cloud-app-broker/issues/316)
// // service without specification has no applications bound to it

View File

@@ -147,7 +147,8 @@ class UpdateInstanceWithNewServiceAcceptanceTest extends CloudFoundryAcceptanceT
deleteServiceInstance(SI_NAME);
// and the backing service is deleted
assertThat(listServiceInstances()).doesNotContain(NEW_BACKING_SI_NAME);
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(NEW_BACKING_SI_NAME));
}
@Override

View File

@@ -153,7 +153,7 @@ class UpdateInstanceWithNewServiceAndTargetAcceptanceTest extends CloudFoundryAc
deleteServiceInstance(SI_NAME);
// and the backing service is deleted
assertThat(listServiceInstances()).doesNotContain(NEW_BACKING_SI_NAME);
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(NEW_BACKING_SI_NAME));
}
@Override

View File

@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
class UpdateInstanceWithServicesAcceptanceTest extends CloudFoundryAcceptanceTest {
@@ -115,7 +116,7 @@ class UpdateInstanceWithServicesAcceptanceTest extends CloudFoundryAcceptanceTes
deleteServiceInstance(SI_NAME);
// and the backing service is deleted
assertThat(listServiceInstances()).doesNotContain(BACKING_SI_NAME);
await().untilAsserted(() -> assertThat(listServiceInstances()).doesNotContain(BACKING_SI_NAME));
}
}