Skip to content

fix: scan every GraphQL error for the active-clusters conflict - #270

Open
ianaya89 wants to merge 1 commit into
masterfrom
fix/active-clusters-scan-all-errors
Open

ianaya89 wants to merge 1 commit into
masterfrom
fix/active-clusters-scan-all-errors

Conversation

@ianaya89

Copy link
Copy Markdown
Member

IsActiveClustersError returned from inside the loop on the first CONFLICT-coded error:

if code, ok := gqlError.Extensions["code"]; ok && code == "CONFLICT" {
    return strings.Contains(gqlError.Message, "forceDestroyClusters=true"), nil
}

When the API reports two conflicts and the active-clusters one is not first, the function answers false and never looks at the rest. FormatDeleteError then falls back to dumping the raw GraphQL messages instead of telling the user to set force_destroy_clusters=true.

Now the code and message are matched together and the loop keeps scanning, which is what IsNotFoundError already does.

TestIsActiveClustersError_ConflictAfterOtherConflict fails on master and passes with the fix. The five existing cases still pass.

IsActiveClustersError returned on the first CONFLICT-coded error, so an
active-clusters conflict reported after another conflict was never seen. The
delete then surfaced the raw GraphQL dump instead of the force_destroy_clusters
hint. Match on code and message together and keep scanning, like
IsNotFoundError does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant