Skip to content

Commit 2f788a3

Browse files
committed
Merge branch '885-user-cleanup' into 2.x
2 parents 6594b5e + a284326 commit 2f788a3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

integration-test/src/test/java/org/cloudfoundry/CloudFoundryCleaner.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ void clean() {
162162
cleanServiceBrokers(this.cloudFoundryClient, this.nameFactory),
163163
cleanSpaceQuotaDefinitions(this.cloudFoundryClient, this.nameFactory),
164164
cleanStacks(this.cloudFoundryClient, this.nameFactory),
165-
cleanUsers(this.cloudFoundryClient, this.nameFactory),
166-
cleanUsers(this.uaaClient, this.nameFactory)
165+
cleanUsers(this.cloudFoundryClient, this.nameFactory)
166+
))
167+
.thenMany(Mono.when(
168+
cleanApplicationsV2(this.cloudFoundryClient, this.nameFactory), // After Routes, cannot run with other cleanApps
169+
cleanUsers(this.uaaClient, this.nameFactory) // After CF Users
167170
))
168-
.thenMany(cleanApplicationsV2(this.cloudFoundryClient, this.nameFactory)) // After Routes, cannot run with other cleanApps
169171
.thenMany(Mono.when( // After Routes/Applications
170172
cleanPrivateDomains(this.cloudFoundryClient, this.nameFactory),
171173
cleanSharedDomains(this.cloudFoundryClient, this.nameFactory),
@@ -552,8 +554,8 @@ private static Flux<Void> cleanUsers(CloudFoundryClient cloudFoundryClient, Name
552554
.async(true)
553555
.userId(userId)
554556
.build())
555-
.doOnError(t -> LOGGER.error("Unable to delete user {}", userId, t)))
556-
.flatMap(job -> JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(5), job));
557+
.flatMapMany(job -> JobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(5), job))
558+
.doOnError(t -> LOGGER.error("Unable to delete user {}", userId, t)));
557559
}
558560

559561
private static Flux<Void> cleanUsers(UaaClient uaaClient, NameFactory nameFactory) {
@@ -599,7 +601,7 @@ private static Flux<Void> ifCfVersion(CloudFoundryVersion expectedVersion, Versi
599601
}
600602

601603
private static boolean isCleanable(NameFactory nameFactory, UserResource resource) {
602-
return nameFactory.isUserId(ResourceUtils.getId(resource)) || nameFactory.isUserId(ResourceUtils.getEntity(resource).getUsername());
604+
return nameFactory.isUserId(ResourceUtils.getId(resource)) || nameFactory.isUserName(ResourceUtils.getEntity(resource).getUsername());
603605
}
604606

605607
private static Flux<Void> removeApplicationServiceBindings(CloudFoundryClient cloudFoundryClient, ApplicationResource application) {

integration-test/src/test/java/org/cloudfoundry/client/v2/UsersTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
import reactor.util.function.Tuples;
7979

8080
import java.time.Duration;
81-
import java.util.concurrent.TimeoutException;
8281

8382
import static org.cloudfoundry.util.tuple.TupleUtils.function;
8483

integration-test/src/test/java/org/cloudfoundry/uaa/UsersTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import reactor.test.StepVerifier;
5151

5252
import java.time.Duration;
53-
import java.util.concurrent.TimeoutException;
5453

5554
import static org.assertj.core.api.Assertions.assertThat;
5655

0 commit comments

Comments
 (0)