mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 20:54:08 +00:00
Merge pull request #28234 from damemi/record-false-bugfix
Automatic merge from submit-queue Make sure --record=false is acknowledged when passed to commands ```release-note Change setting "kubectl --record=false" to stop updating the change-cause when a previous change-cause is found. ``` Ensures that when `--record=false` is explicity set that no `ChangeCauseAnnotation`s are set on the object. Previously, if `--record=true` was used then all following actions triggered a `ChangeCauseAnnotation` even if `--record=false` was set, due to the prior `ChangeCauseAnnotation` existing. Reference to bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1351127 []()
This commit is contained in:
@@ -598,6 +598,27 @@ runTests() {
|
||||
# Post-condition: valid-pod is labelled
|
||||
kube::test::get_object_assert 'pod valid-pod' "{{range$labels_field}}{{.}}:{{end}}" 'valid-pod:new-valid-pod:'
|
||||
|
||||
### Record label change
|
||||
# Pre-condition: valid-pod does not have record annotation
|
||||
kube::test::get_object_assert 'pod valid-pod' "{{range.items}}{{$annotations_field}}:{{end}}" ''
|
||||
# Command
|
||||
kubectl label pods valid-pod record-change=true --record=true "${kube_flags[@]}"
|
||||
# Post-condition: valid-pod has record annotation
|
||||
kube::test::get_object_assert 'pod valid-pod' "{{range$annotations_field}}{{.}}:{{end}}" ".*--record=true.*"
|
||||
|
||||
### Do not record label change
|
||||
# Command
|
||||
kubectl label pods valid-pod no-record-change=true --record=false "${kube_flags[@]}"
|
||||
# Post-condition: valid-pod's record annotation still contains command with --record=true
|
||||
kube::test::get_object_assert 'pod valid-pod' "{{range$annotations_field}}{{.}}:{{end}}" ".*--record=true.*"
|
||||
|
||||
### Record label change with unspecified flag and previous change already recorded
|
||||
# Command
|
||||
kubectl label pods valid-pod new-record-change=true "${kube_flags[@]}"
|
||||
# Post-condition: valid-pod's record annotation contains new change
|
||||
kube::test::get_object_assert 'pod valid-pod' "{{range$annotations_field}}{{.}}:{{end}}" ".*new-record-change=true.*"
|
||||
|
||||
|
||||
### Delete POD by label
|
||||
# Pre-condition: valid-pod POD exists
|
||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
||||
|
Reference in New Issue
Block a user