diff --git a/tests/e2e/snapshotrestore/snapshotrestore_test.go b/tests/e2e/snapshotrestore/snapshotrestore_test.go index eb5b1c6848..6febaa73cd 100644 --- a/tests/e2e/snapshotrestore/snapshotrestore_test.go +++ b/tests/e2e/snapshotrestore/snapshotrestore_test.go @@ -95,7 +95,7 @@ var _ = Describe("Verify snapshots and cluster restores work", Ordered, func() { cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-clusterip --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) g.Expect(err).NotTo(HaveOccurred()) - g.Expect(res).Should((ContainSubstring("test-clusterip")), "failed cmd: "+cmd+" result: "+res) + g.Expect(res).Should((ContainSubstring("test-clusterip")), "failed cmd: %q result: %s", cmd, res) }, "240s", "5s").Should(Succeed()) }) diff --git a/tests/e2e/validatecluster/validatecluster_test.go b/tests/e2e/validatecluster/validatecluster_test.go index efc2003fd8..8db46e673c 100644 --- a/tests/e2e/validatecluster/validatecluster_test.go +++ b/tests/e2e/validatecluster/validatecluster_test.go @@ -95,7 +95,7 @@ var _ = Describe("Verify Create", Ordered, func() { cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-clusterip --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) Expect(err).NotTo(HaveOccurred()) - g.Expect(res).Should((ContainSubstring("test-clusterip")), "failed cmd: "+cmd+" result: "+res) + g.Expect(res).Should((ContainSubstring("test-clusterip")), "failed cmd: %q result: %s", cmd, res) }, "240s", "5s").Should(Succeed()) clusterip, _ := e2e.FetchClusterIP(kubeConfigFile, "nginx-clusterip-svc", false) @@ -130,7 +130,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("test-nodeport")) }, "240s", "5s").Should(Succeed()) } @@ -150,14 +150,14 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl get pods -o=name -l k8s-app=nginx-app-loadbalancer --field-selector=status.phase=Running --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("test-loadbalancer")) }, "240s", "5s").Should(Succeed()) Eventually(func(g Gomega) { cmd = "curl -L --insecure http://" + ip + ":" + port + "/name.html" res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("test-loadbalancer")) }, "240s", "5s").Should(Succeed()) } @@ -174,7 +174,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("test-ingress")) }, "240s", "5s").Should(Succeed()) } @@ -204,7 +204,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl get pods dnsutils --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("dnsutils")) }, "420s", "2s").Should(Succeed()) @@ -212,7 +212,7 @@ var _ = Describe("Verify Create", Ordered, func() { cmd := "kubectl --kubeconfig=" + kubeConfigFile + " exec -i -t dnsutils -- nslookup kubernetes.default" res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("kubernetes.default.svc.cluster.local")) }, "420s", "2s").Should(Succeed()) }) @@ -224,7 +224,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl get pvc local-path-pvc --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("local-path-pvc")) g.Expect(res).Should(ContainSubstring("Bound")) }, "420s", "2s").Should(Succeed()) @@ -232,18 +232,18 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl get pod volume-test --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("volume-test")) g.Expect(res).Should(ContainSubstring("Running")) }, "420s", "2s").Should(Succeed()) cmd := "kubectl --kubeconfig=" + kubeConfigFile + " exec volume-test -- sh -c 'echo local-path-test > /data/test'" res, err = e2e.RunCommand(cmd) - Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) cmd = "kubectl delete pod volume-test --kubeconfig=" + kubeConfigFile res, err = e2e.RunCommand(cmd) - Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) _, err = e2e.DeployWorkload("local-path-provisioner.yaml", kubeConfigFile, *hardened) Expect(err).NotTo(HaveOccurred(), "local-path-provisioner manifest not deployed") @@ -257,7 +257,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl get pod volume-test --kubeconfig=" + kubeConfigFile res, err := e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) g.Expect(res).Should(ContainSubstring("volume-test")) g.Expect(res).Should(ContainSubstring("Running")) @@ -266,7 +266,7 @@ var _ = Describe("Verify Create", Ordered, func() { Eventually(func(g Gomega) { cmd := "kubectl exec volume-test --kubeconfig=" + kubeConfigFile + " -- cat /data/test" res, err = e2e.RunCommand(cmd) - g.Expect(err).NotTo(HaveOccurred(), "failed cmd: "+cmd+" result: "+res) + g.Expect(err).NotTo(HaveOccurred(), "failed cmd: %q result: %s", cmd, res) fmt.Println("Data after re-creation", res) g.Expect(res).Should(ContainSubstring("local-path-test")) }, "180s", "2s").Should(Succeed())