From 657db0a2b5cec39223152c5f1e1869ea10cfae76 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 28 Sep 2015 12:21:00 +0200 Subject: [PATCH] Add missing guards around SSH based e2e tests All other e2e tests which use SSH are skipped for providers other than gce, gke and aws. This patch does the same for - "should release NodePorts on delete" in service.go - "should test privileged pod" in privileged.go. --- test/e2e/privileged.go | 1 + test/e2e/service.go | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/test/e2e/privileged.go b/test/e2e/privileged.go index e2cbf5f1ea4..b2cf98e08f1 100644 --- a/test/e2e/privileged.go +++ b/test/e2e/privileged.go @@ -52,6 +52,7 @@ var _ = Describe("PrivilegedPod", func() { f: f, } It("should test privileged pod", func() { + SkipUnlessProviderIs(providersWithSSH...) By("Getting ssh-able hosts") hosts, err := NodeSSHHosts(config.f.Client) diff --git a/test/e2e/service.go b/test/e2e/service.go index e8d4fbcd6ae..a31b38f8675 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -532,14 +532,17 @@ var _ = Describe("Services", func() { ip := pickNodeIP(c) testReachable(ip, nodePort) - hosts, err := NodeSSHHosts(c) - if err != nil { - Expect(err).NotTo(HaveOccurred()) - } - cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) - _, _, code, err := SSH(cmd, hosts[0], testContext.Provider) - if code != 0 { - Failf("expected node port (%d) to be in use", nodePort) + // this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP + if providerIs(providersWithSSH...) { + hosts, err := NodeSSHHosts(c) + if err != nil { + Expect(err).NotTo(HaveOccurred()) + } + cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) + _, _, code, err := SSH(cmd, hosts[0], testContext.Provider) + if code != 0 { + Failf("expected node port (%d) to be in use", nodePort) + } } }) @@ -965,14 +968,17 @@ var _ = Describe("Services", func() { err = t.DeleteService(serviceName) Expect(err).NotTo(HaveOccurred()) - hosts, err := NodeSSHHosts(c) - if err != nil { - Expect(err).NotTo(HaveOccurred()) - } - cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) - _, _, code, err := SSH(cmd, hosts[0], testContext.Provider) - if code == 0 { - Failf("expected node port (%d) to not be in use", nodePort) + // this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP + if providerIs(providersWithSSH...) { + hosts, err := NodeSSHHosts(c) + if err != nil { + Expect(err).NotTo(HaveOccurred()) + } + cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) + _, _, code, err := SSH(cmd, hosts[0], testContext.Provider) + if code == 0 { + Failf("expected node port (%d) to not be in use", nodePort) + } } By(fmt.Sprintf("creating service "+serviceName+" with same NodePort %d", nodePort))