@@ -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 ) {
0 commit comments