Commit 5ecc2629 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

Refactor kubeproxy tests to run with and without provider SSH support

All other e2e tests which use SSH are skipped for providers other than gce, gke and aws. This patch does the same for the kube-proxy test. If not SSH support is available for the provider, the test will still run, but use less probes.
parent 657db0a2
...@@ -68,7 +68,10 @@ var _ = Describe("KubeProxy", func() { ...@@ -68,7 +68,10 @@ var _ = Describe("KubeProxy", func() {
config := &KubeProxyTestConfig{ config := &KubeProxyTestConfig{
f: f, f: f,
} }
It("should test kube-proxy", func() { It("should test kube-proxy", func() {
SkipUnlessProviderIs(providersWithSSH...)
By("cleaning up any pre-existing namespaces used by this test") By("cleaning up any pre-existing namespaces used by this test")
config.cleanup() config.cleanup()
...@@ -164,7 +167,7 @@ func (config *KubeProxyTestConfig) hitClusterIP(epCount int) { ...@@ -164,7 +167,7 @@ func (config *KubeProxyTestConfig) hitClusterIP(epCount int) {
} }
func (config *KubeProxyTestConfig) hitNodePort(epCount int) { func (config *KubeProxyTestConfig) hitNodePort(epCount int) {
node1_IP := strings.TrimSuffix(config.nodes[0], ":22") node1_IP := config.nodes[0]
tries := epCount*epCount + 5 // + 10 if epCount == 0 tries := epCount*epCount + 5 // + 10 if epCount == 0
By("dialing(udp) node1 --> node1:nodeUdpPort") By("dialing(udp) node1 --> node1:nodeUdpPort")
config.dialFromNode("udp", node1_IP, nodeUdpPort, tries, epCount) config.dialFromNode("udp", node1_IP, nodeUdpPort, tries, epCount)
...@@ -188,7 +191,7 @@ func (config *KubeProxyTestConfig) hitNodePort(epCount int) { ...@@ -188,7 +191,7 @@ func (config *KubeProxyTestConfig) hitNodePort(epCount int) {
By("Test disabled. dialing(http) node --> 127.0.0.1:nodeHttpPort") By("Test disabled. dialing(http) node --> 127.0.0.1:nodeHttpPort")
//config.dialFromNode("http", "127.0.0.1", nodeHttpPort, tries, epCount) //config.dialFromNode("http", "127.0.0.1", nodeHttpPort, tries, epCount)
node2_IP := strings.TrimSuffix(config.nodes[1], ":22") node2_IP := config.nodes[1]
By("dialing(udp) node1 --> node2:nodeUdpPort") By("dialing(udp) node1 --> node2:nodeUdpPort")
config.dialFromNode("udp", node2_IP, nodeUdpPort, tries, epCount) config.dialFromNode("udp", node2_IP, nodeUdpPort, tries, epCount)
By("dialing(http) node1 --> node2:nodeHttpPort") By("dialing(http) node1 --> node2:nodeHttpPort")
...@@ -249,7 +252,7 @@ func (config *KubeProxyTestConfig) dialFromNode(protocol, targetIP string, targe ...@@ -249,7 +252,7 @@ func (config *KubeProxyTestConfig) dialFromNode(protocol, targetIP string, targe
} }
func (config *KubeProxyTestConfig) ssh(cmd string) string { func (config *KubeProxyTestConfig) ssh(cmd string) string {
stdout, _, code, err := SSH(cmd, config.nodes[0], testContext.Provider) stdout, _, code, err := SSH(cmd, config.nodes[0]+":22", testContext.Provider)
Expect(err).NotTo(HaveOccurred(), "error while SSH-ing to node: %v (code %v)", err, code) Expect(err).NotTo(HaveOccurred(), "error while SSH-ing to node: %v (code %v)", err, code)
Expect(code).Should(BeZero(), "command exited with non-zero code %v. cmd:%s", code, cmd) Expect(code).Should(BeZero(), "command exited with non-zero code %v. cmd:%s", code, cmd)
return stdout return stdout
...@@ -421,10 +424,10 @@ func (config *KubeProxyTestConfig) setup() { ...@@ -421,10 +424,10 @@ func (config *KubeProxyTestConfig) setup() {
By("Getting ssh-able hosts") By("Getting ssh-able hosts")
hosts, err := NodeSSHHosts(config.f.Client) hosts, err := NodeSSHHosts(config.f.Client)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
if len(hosts) == 0 { config.nodes = make([]string, 0, len(hosts))
Failf("No ssh-able nodes") for _, h := range hosts {
config.nodes = append(config.nodes, strings.TrimSuffix(h, ":22"))
} }
config.nodes = hosts
if enableLoadBalancerTest { if enableLoadBalancerTest {
By("Creating the LoadBalancer Service on top of the pods in kubernetes") By("Creating the LoadBalancer Service on top of the pods in kubernetes")
......
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