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.
This commit is contained in:
Dr. Stefan Schimanski 2015-09-28 12:21:00 +02:00
parent a68e0848dc
commit 657db0a2b5
2 changed files with 23 additions and 16 deletions

View File

@ -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)

View File

@ -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))