@@ -2,13 +2,13 @@ package test
22
33import (
44 "e2e_test/test/framework"
5- "fmt"
65 "github.com/appscode/go/wait"
76 "github.com/codeskyblue/go-sh"
87 . "github.com/onsi/ginkgo"
98 . "github.com/onsi/gomega"
109 core "k8s.io/api/core/v1"
1110 "k8s.io/apimachinery/pkg/util/intstr"
11+ "log"
1212 "strings"
1313)
1414
@@ -69,7 +69,7 @@ var _ = Describe("CloudControllerManager", func() {
6969 Expect (err ).NotTo (HaveOccurred ())
7070 }
7171
72- PDescribe ("Test" , func () {
72+ Describe ("Test" , func () {
7373 Context ("Simple" , func () {
7474 Context ("Load Balancer" , func () {
7575 var (
@@ -128,10 +128,10 @@ var _ = Describe("CloudControllerManager", func() {
128128 }
129129 stringResp := string (resp )
130130 if strings .Contains (stringResp , pods [0 ]) {
131- fmt .Println ("Got response from " + pods [0 ])
131+ log .Println ("Got response from " + pods [0 ])
132132 counter1 ++
133133 } else if strings .Contains (stringResp , pods [1 ]) {
134- fmt .Println ("Got response from " + pods [1 ])
134+ log .Println ("Got response from " + pods [1 ])
135135 counter2 ++
136136 }
137137
@@ -215,7 +215,7 @@ var _ = Describe("CloudControllerManager", func() {
215215 })
216216 })
217217
218- Context ("With Multiple TLS Port " , func () {
218+ Context ("With Multiple TLS Ports " , func () {
219219 var (
220220 pods []string
221221 labels map [string ]string
@@ -297,7 +297,71 @@ var _ = Describe("CloudControllerManager", func() {
297297 }
298298 })
299299 })
300+
301+ Context ("With Multiple HTTP Ports" , func () {
302+ var (
303+ pods []string
304+ labels map [string ]string
305+ )
306+
307+ BeforeEach (func () {
308+ pods = []string {"test-pod" }
309+ ports := []core.ContainerPort {
310+ {
311+ Name : "http-1" ,
312+ ContainerPort : 8080 ,
313+ },
314+ {
315+ Name : "http-2" ,
316+ ContainerPort : 8989 ,
317+ },
318+ }
319+ servicePorts := []core.ServicePort {
320+ {
321+ Name : "http-1" ,
322+ Port : 80 ,
323+ TargetPort : intstr .FromInt (8080 ),
324+ Protocol : "TCP" ,
325+ },
326+ {
327+ Name : "http-2" ,
328+ Port : 8888 ,
329+ TargetPort : intstr .FromInt (8989 ),
330+ Protocol : "TCP" ,
331+ },
332+ }
333+ labels = map [string ]string {
334+ "app" : "test-loadbalancer" ,
335+ }
336+
337+ By ("Creating Pods" )
338+ createPodWithLabel (pods , ports , framework .TestServerImage , labels , true )
339+
340+ By ("Creating Service" )
341+ createServiceWithSelector (labels , servicePorts )
342+ })
343+
344+ AfterEach (func () {
345+ By ("Deleting the Pods" )
346+ deletePods (pods )
347+
348+ By ("Deleting the Service" )
349+ deleteService ()
350+ })
351+
352+ It ("should reach all pods" , func () {
353+ By ("Checking TCP Response" )
354+ eps , err := f .LoadBalancer .GetHTTPEndpoints ()
355+ Expect (err ).NotTo (HaveOccurred ())
356+ Expect (len (eps )).Should (BeNumerically (">=" , 1 ))
357+
358+ By ("Waiting for Response from the LoadBalancer url: " + eps [0 ] + " " + eps [1 ])
359+ for _ , ep := range eps {
360+ err = framework .WaitForHTTPResponse (ep , pods [0 ])
361+ Expect (err ).NotTo (HaveOccurred ())
362+ }
363+ })
364+ })
300365 })
301366 })
302-
303367})
0 commit comments