diff --git a/tests/e2e/privateregistry/privateregistry_test.go b/tests/e2e/privateregistry/privateregistry_test.go index 2b779de00882..1018ffa0a2d9 100644 --- a/tests/e2e/privateregistry/privateregistry_test.go +++ b/tests/e2e/privateregistry/privateregistry_test.go @@ -86,14 +86,12 @@ var _ = Describe("Verify Create", Ordered, func() { It("Create new private registry", func() { registry, err := e2e.RunCmdOnNode("sudo docker run -d -p 5000:5000 --restart=always --name registry registry:2 ", serverNodeNames[0]) - fmt.Println(registry) - Expect(err).NotTo(HaveOccurred()) + Expect(err).NotTo(HaveOccurred(), registry) }) It("ensures registry is working", func() { a, err := e2e.RunCmdOnNode("sudo docker ps -a | grep registry\n", serverNodeNames[0]) - fmt.Println(a) - Expect(err).NotTo(HaveOccurred()) + Expect(err).NotTo(HaveOccurred(), a) }) It("Should pull and image from dockerhub and send it to private registry", func() { @@ -101,25 +99,21 @@ var _ = Describe("Verify Create", Ordered, func() { _, err := e2e.RunCmdOnNode(cmd, serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), "failed: "+cmd) - nodeIP, err := e2e.FetchNodeExternalIP(serverNodeNames[0]) - Expect(err).NotTo(HaveOccurred()) - - cmd = "sudo docker tag nginx " + nodeIP + ":5000/my-webpage" + cmd = "sudo docker tag nginx server-0.local:5000/my-webpage" _, err = e2e.RunCmdOnNode(cmd, serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), "failed: "+cmd) - cmd = "sudo docker push " + nodeIP + ":5000/my-webpage" + cmd = "sudo docker push server-0.local:5000/my-webpage" _, err = e2e.RunCmdOnNode(cmd, serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), "failed: "+cmd) - cmd = "sudo docker image remove nginx " + nodeIP + ":5000/my-webpage" + cmd = "sudo docker image remove nginx server-0.local:5000/my-webpage" _, err = e2e.RunCmdOnNode(cmd, serverNodeNames[0]) Expect(err).NotTo(HaveOccurred(), "failed: "+cmd) }) It("Should create and validate deployment with private registry on", func() { - res, err := e2e.RunCmdOnNode("sudo kubectl create deployment my-webpage --image=my-registry.local/my-webpage", serverNodeNames[0]) - fmt.Println(res) - Expect(err).NotTo(HaveOccurred()) + res, err := e2e.RunCmdOnNode("sudo kubectl create deployment my-webpage --image=server-0.local/my-webpage", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred(), res) var pod e2e.Pod Eventually(func(g Gomega) { @@ -147,15 +141,13 @@ var _ = AfterEach(func() { }) var _ = AfterSuite(func() { - r1, err := e2e.RunCmdOnNode("sudo docker rm -f registry", serverNodeNames[0]) - fmt.Println(r1) - Expect(err).NotTo(HaveOccurred()) - r2, err := e2e.RunCmdOnNode("sudo kubectl delete deployment my-webpage", serverNodeNames[0]) - fmt.Println(r2) - Expect(err).NotTo(HaveOccurred()) if failed && !*ci { fmt.Println("FAILED!") } else { + rm1, err := e2e.RunCmdOnNode("sudo docker rm -f registry", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred(), rm1) + rm2, err := e2e.RunCmdOnNode("sudo kubectl delete deployment my-webpage", serverNodeNames[0]) + Expect(err).NotTo(HaveOccurred(), rm2) Expect(e2e.DestroyCluster()).To(Succeed()) Expect(os.Remove(kubeConfigFile)).To(Succeed()) }