mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Merge pull request #52450 from juanvallejo/jvallejo/misc-err-msg-improvements
Automatic merge from submit-queue (batch tested with PRs 52485, 52443, 52597, 52450, 51971). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Error message / exit code fixes **Release note**: ```release-note NONE ``` Miscellaneous error message tweaks. Makes the error message displayed in `kubectl get` more visible. Returns exit code 1 if a patch fails. Addresses the following downstream bugzillas: - https://bugzilla.redhat.com/show_bug.cgi?id=1311786 - https://bugzilla.redhat.com/show_bug.cgi?id=1414227 cc @fabianofranz @kubernetes/sig-cli-misc
This commit is contained in:
@@ -694,6 +694,10 @@ run_pod_tests() {
|
||||
## Patch can modify a local object
|
||||
kubectl patch --local -f pkg/kubectl/validation/testdata/v1/validPod.yaml --patch='{"spec": {"restartPolicy":"Never"}}' -o jsonpath='{.spec.restartPolicy}' | grep -q "Never"
|
||||
|
||||
## Patch fails with error message "not patched" and exit code 1
|
||||
output_message=$(! kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"spec":{"replicas":7}}' 2>&1)
|
||||
kube::test::if_has_string "${output_message}" 'not patched'
|
||||
|
||||
## Patch pod can change image
|
||||
# Command
|
||||
kubectl patch "${kube_flags[@]}" pod valid-pod --record -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "nginx"}]}}'
|
||||
|
Reference in New Issue
Block a user