mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
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:
parent
a68e0848dc
commit
657db0a2b5
@ -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)
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user