Commit 657db0a2 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

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.
parent a68e0848
...@@ -52,6 +52,7 @@ var _ = Describe("PrivilegedPod", func() { ...@@ -52,6 +52,7 @@ var _ = Describe("PrivilegedPod", func() {
f: f, f: f,
} }
It("should test privileged pod", func() { It("should test privileged pod", func() {
SkipUnlessProviderIs(providersWithSSH...)
By("Getting ssh-able hosts") By("Getting ssh-able hosts")
hosts, err := NodeSSHHosts(config.f.Client) hosts, err := NodeSSHHosts(config.f.Client)
......
...@@ -532,14 +532,17 @@ var _ = Describe("Services", func() { ...@@ -532,14 +532,17 @@ var _ = Describe("Services", func() {
ip := pickNodeIP(c) ip := pickNodeIP(c)
testReachable(ip, nodePort) testReachable(ip, nodePort)
hosts, err := NodeSSHHosts(c) // this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
if err != nil { if providerIs(providersWithSSH...) {
Expect(err).NotTo(HaveOccurred()) hosts, err := NodeSSHHosts(c)
} if err != nil {
cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) Expect(err).NotTo(HaveOccurred())
_, _, code, err := SSH(cmd, hosts[0], testContext.Provider) }
if code != 0 { cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort)
Failf("expected node port (%d) to be in use", 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() { ...@@ -965,14 +968,17 @@ var _ = Describe("Services", func() {
err = t.DeleteService(serviceName) err = t.DeleteService(serviceName)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
hosts, err := NodeSSHHosts(c) // this test uses NodeSSHHosts that does not work if a Node only reports LegacyHostIP
if err != nil { if providerIs(providersWithSSH...) {
Expect(err).NotTo(HaveOccurred()) hosts, err := NodeSSHHosts(c)
} if err != nil {
cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort) Expect(err).NotTo(HaveOccurred())
_, _, code, err := SSH(cmd, hosts[0], testContext.Provider) }
if code == 0 { cmd := fmt.Sprintf(`test -n "$(ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN)"`, nodePort)
Failf("expected node port (%d) to not be in use", 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)) By(fmt.Sprintf("creating service "+serviceName+" with same NodePort %d", nodePort))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment