Fixes issue where test was not waiting for the creation of service in stance to complete #1161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
updatetest does two things: 1.) it creates a managed service instance and 2.) it updates the managed service instance. The second part was failing because CloudController will refuse to update a service that's still being created.The update job was calling a method
waitForCompletionOnCreatewhich was looking at the CreateServiceInstanceResponse object to see if it had an job id, if it did, then it would callJobUtils.waitForCompletion(cloudFoundryClient, Duration.ofMinutes(1), createServiceInstanceResponse.getJobId().get())and then returngetServiceInstanceIdByName(cloudFoundryClient, serviceInstanceName). The problem is that the call toJobUtils.waitForCompletionwas creating a flow but nothing was subscribing to it, so it never actually ran and the test would not pause until the creation finished.The test has been modified such that it assumes the creation request will be asynch and return a job id. If it does not for some reason, the test would fail as wel call
.get()on an optional object and calling that if the optional is empty will generate a NoSuchElementException. Then with the jobId, we callJobUtils.waitForCompletionwrapped in a flatMap, which ensures it's part of the overall flow which is being subscribed to.The same change was made after the update request, which also returns an asynch response and needs to be polled.
Signed-off-by: Daniel Mikusa dmikusa@vmware.com