Merge pull request #67385 from nikhita/patch-no-op-msg

Automatic merge from submit-queue (batch tested with PRs 67347, 67307, 67358, 67364, 67385). 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>.

kubectl: update message for a no-op patch

Fixes https://github.com/kubernetes/kubernetes/issues/67344

/cc liggitt juanvallejo soltysh timoreimann 
/sig cli

**Release note**:

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-08-15 04:23:24 -07:00 committed by GitHub
commit a8fbaf95f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -331,5 +331,5 @@ func patchOperation(didPatch bool) string {
if didPatch {
return "patched"
}
return "not patched"
return "patched (no change)"
}

View File

@ -439,9 +439,9 @@ run_pod_tests() {
output_message=$(! kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"metadata":{"labels":"invalid"}}' 2>&1)
kube::test::if_has_string "${output_message}" 'cannot restore map from string'
## Patch exits with error message "not patched" and exit code 0 when no-op occurs
## Patch exits with error message "patched (no change)" and exit code 0 when no-op occurs
output_message=$(kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"metadata":{"labels":{"name":"valid-pod"}}}' 2>&1)
kube::test::if_has_string "${output_message}" 'not patched'
kube::test::if_has_string "${output_message}" 'patched (no change)'
## Patch pod can change image
# Command