mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Merge pull request #95831 from cpanato/fix-test-flaky
use patch instead of replace to test the dry-run option
This commit is contained in:
commit
7e1f4a9fa3
6
test/conformance/testdata/conformance.yaml
vendored
6
test/conformance/testdata/conformance.yaml
vendored
@ -1476,9 +1476,9 @@
|
||||
codename: '[sig-cli] Kubectl client Kubectl server-side dry-run should check if
|
||||
kubectl can dry-run update Pods [Conformance]'
|
||||
description: The command 'kubectl run' must create a pod with the specified image
|
||||
name. After, the command 'kubectl replace --dry-run=server' should update the
|
||||
Pod with the new image name and server-side dry-run enabled. The image name must
|
||||
not change.
|
||||
name. After, the command 'kubectl patch pod -p {...} --dry-run=server' should
|
||||
update the Pod with the new image name and server-side dry-run enabled. The image
|
||||
name must not change.
|
||||
release: v1.19
|
||||
file: test/e2e/kubectl/kubectl.go
|
||||
- testname: Kubectl, version
|
||||
|
@ -910,7 +910,7 @@ metadata:
|
||||
/*
|
||||
Release: v1.19
|
||||
Testname: Kubectl, server-side dry-run Pod
|
||||
Description: The command 'kubectl run' must create a pod with the specified image name. After, the command 'kubectl replace --dry-run=server' should update the Pod with the new image name and server-side dry-run enabled. The image name must not change.
|
||||
Description: The command 'kubectl run' must create a pod with the specified image name. After, the command 'kubectl patch pod -p {...} --dry-run=server' should update the Pod with the new image name and server-side dry-run enabled. The image name must not change.
|
||||
*/
|
||||
framework.ConformanceIt("should check if kubectl can dry-run update Pods", func() {
|
||||
ginkgo.By("running the image " + httpdImage)
|
||||
@ -918,12 +918,8 @@ metadata:
|
||||
framework.RunKubectlOrDie(ns, "run", podName, "--image="+httpdImage, "--labels=run="+podName)
|
||||
|
||||
ginkgo.By("replace the image in the pod with server-side dry-run")
|
||||
podJSON := framework.RunKubectlOrDie(ns, "get", "pod", podName, "-o", "json")
|
||||
podJSON = strings.Replace(podJSON, httpdImage, busyboxImage, 1)
|
||||
if !strings.Contains(podJSON, busyboxImage) {
|
||||
framework.Failf("Failed replacing image from %s to %s in:\n%s\n", httpdImage, busyboxImage, podJSON)
|
||||
}
|
||||
framework.RunKubectlOrDieInput(ns, podJSON, "replace", "-f", "-", "--dry-run=server")
|
||||
specImage := fmt.Sprintf(`{"spec":{"containers":[{"name": "%s","image": "%s"}]}}`, podName, busyboxImage)
|
||||
framework.RunKubectlOrDie(ns, "patch", "pod", podName, "-p", specImage, "--dry-run=server")
|
||||
|
||||
ginkgo.By("verifying the pod " + podName + " has the right image " + httpdImage)
|
||||
pod, err := c.CoreV1().Pods(ns).Get(context.TODO(), podName, metav1.GetOptions{})
|
||||
|
Loading…
Reference in New Issue
Block a user