Repository navigation
fix: Make TasksTest.cancel independent of the task's timing (5.x.x) - #1420
Merged
Merged
Conversation
The Cloud Controller sets a canceled task to CANCELING, cancels it in Diego and then reloads it for the response. When Diego reports the canceled task as FAILED before that reload, the response shows FAILED and the test failed with "expected value: CANCELING; actual value: FAILED". The test now accepts CANCELING and FAILED, and cancels a "sleep 99" task instead of "ls", which could finish before the cancel request and make the Cloud Controller reject it.
Lokowandtg
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TasksTest.cancelflakes, e.g. in the v2 job of #1409 (run 45671668192):Cause
The Cloud Controller's cancel endpoint (
TaskCancel,TasksController#cancel) sets the task toCANCELING, cancels it in Diego and then renderstask.reload. When Diego's completion callback has already marked the canceled taskFAILEDby then, the response showsFAILED.A second race: the test canceled an
lstask. If that finished before the cancel request, the Cloud Controller rejects the cancel withTask state is SUCCEEDED and therefore cannot be canceled.Changes
CANCELINGorFAILEDin the cancel response (asDeploymentsTestdoes forCANCELING/CANCELED).sleep 99task, likeoperations.ApplicationsTest.terminateTaskdoes, so the task is still running when the cancel arrives.Testing
./mvnw -Pintegration-test -DskipTests -Dmaven.javadoc.skip spotless:check installpasses (JDK 11).The main counterpart is #1419.