Skip to content

Commit 0029512

Browse files
committed
Fix app restart integration test
1 parent 97d78a0 commit 0029512

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

integration-test/src/test/java/org/cloudfoundry/client/v3/ApplicationsTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
import org.cloudfoundry.client.v3.domains.CreateDomainRequest;
6464
import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
6565
import org.cloudfoundry.client.v3.domains.DomainRelationships;
66-
import org.cloudfoundry.client.v3.droplets.DropletResource;
67-
import org.cloudfoundry.client.v3.droplets.ListDropletsRequest;
6866
import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest;
6967
import org.cloudfoundry.client.v3.organizations.CreateOrganizationResponse;
7068
import org.cloudfoundry.client.v3.packages.CreatePackageRequest;
@@ -93,7 +91,6 @@
9391
import org.junit.Test;
9492
import org.springframework.beans.factory.annotation.Autowired;
9593
import org.springframework.core.io.ClassPathResource;
96-
import reactor.core.publisher.Flux;
9794
import reactor.core.publisher.Mono;
9895
import reactor.test.StepVerifier;
9996
import reactor.util.function.Tuples;
@@ -667,16 +664,18 @@ public void restart() {
667664
.flatMap(spaceId -> createApplicationId(this.cloudFoundryClient, applicationName, spaceId))
668665
.delayUntil(applicationId -> prepareApplicationToStart(this.cloudFoundryClient, applicationId))
669666
.delayUntil(applicationId -> requestStartApplication(this.cloudFoundryClient, applicationId))
670-
.flatMap(applicationId -> requestGetApplication(this.cloudFoundryClient, applicationId)
671-
.map(application -> Instant.parse(application.getUpdatedAt()))
667+
.flatMap(applicationId -> requestApplicationProcess(this.cloudFoundryClient, applicationId)
668+
.map(process -> Instant.parse(process.getUpdatedAt()))
672669
.map(updatedAt -> Tuples.of(applicationId, updatedAt)))
673670
.delayUntil(function((applicationId, oldUpdatedAt) -> this.cloudFoundryClient.applicationsV3()
674671
.restart(RestartApplicationRequest.builder()
675672
.applicationId(applicationId)
676-
.build())))
677-
.flatMap(function((applicationId, oldUpdatedAt) -> requestGetApplication(this.cloudFoundryClient, applicationId)
678-
.map(application -> Instant.parse(application.getUpdatedAt()))
679-
.map(newUpdatedAt -> Tuples.of(oldUpdatedAt, newUpdatedAt))))
673+
.build())
674+
.delaySubscription(Duration.ofSeconds(2))))
675+
.flatMap(function((applicationId, oldUpdatedAt) -> requestApplicationProcess(this.cloudFoundryClient, applicationId)
676+
.map(process -> Instant.parse(process.getUpdatedAt()))
677+
.map(newUpdatedAt -> Tuples.of(oldUpdatedAt, newUpdatedAt))
678+
.delaySubscription(Duration.ofSeconds(2))))
680679
.as(StepVerifier::create)
681680
.consumeNextWith(consumer((oldUpdatedAt, newUpdatedAt) -> assertThat(newUpdatedAt).isAfter(oldUpdatedAt)))
682681
.expectComplete()
@@ -817,6 +816,7 @@ private static Mono<Boolean> getFeatureEnabled(CloudFoundryClient cloudFoundryCl
817816
}
818817

819818
private static Mono<GetApplicationProcessResponse> requestApplicationProcess(CloudFoundryClient cloudFoundryClient, String applicationId) {
819+
System.out.println(Instant.now());
820820
return cloudFoundryClient.applicationsV3()
821821
.getProcess(GetApplicationProcessRequest.builder()
822822
.applicationId(applicationId)

0 commit comments

Comments
 (0)