mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
add/update tests
Move negative check for testing "not patched" output to test-cmd-util.sh as exiting with code 1 was causing patch_test.go to fail when the error was expected as part of the test.
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