Skip to content

Commit

Permalink
馃悰 fakeClient.Status().Update(...) cannot recognize resource version
Browse files Browse the repository at this point in the history
conflicts

The fake client of subresource is unable to correctly handle the case of
resource version conflict when updating. The phenomenon is that it did
not return a 409 status error.

Signed-off-by: iiiceoo <iiiceoo@foxmail.com>
  • Loading branch information
iiiceoo committed May 31, 2023
1 parent 30eae58 commit 9c93dc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/client/fake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,11 @@ func copyNonStatusFrom(old, new runtime.Object) error {
}
}

newClientObject.SetResourceVersion(rv)

if err := fromMapStringAny(newMapStringAny, new); err != nil {
return fmt.Errorf("failed to convert back from map[string]any: %w", err)
}
newClientObject.SetResourceVersion(rv)

return nil
}

Expand Down

0 comments on commit 9c93dc1

Please sign in to comment.