Skip to content

Commit 19250dd

Browse files
committed
Use curl for testing session affinity, and remove session affinity test
1 parent 896a58c commit 19250dd

2 files changed

Lines changed: 10 additions & 57 deletions

File tree

e2e/test/ccm_e2e_test.go

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ var _ = Describe("e2e tests", func() {
294294
eps, err = f.LoadBalancer.GetLoadBalancerIps()
295295
return err
296296
}).Should(BeNil())
297-
Eventually(framework.WaitForHTTPResponse).WithArguments(eps[0]).Should(ContainSubstring(pods[0]))
298-
Eventually(framework.WaitForHTTPResponse).WithArguments(eps[0]).Should(ContainSubstring(pods[1]))
297+
Eventually(framework.GetResponseFromCurl).WithArguments(eps[0]).Should(ContainSubstring(pods[0]))
298+
Eventually(framework.GetResponseFromCurl).WithArguments(eps[0]).Should(ContainSubstring(pods[1]))
299299
})
300300
})
301301
})
@@ -756,61 +756,6 @@ var _ = Describe("e2e tests", func() {
756756
})
757757
})
758758

759-
Context("With SessionAffinity", func() {
760-
var (
761-
pods []string
762-
labels map[string]string
763-
)
764-
765-
BeforeEach(func() {
766-
pods = []string{"test-pod-1", "test-pod-2"}
767-
ports := []core.ContainerPort{
768-
{
769-
Name: "http-1",
770-
ContainerPort: 8080,
771-
},
772-
}
773-
servicePorts := []core.ServicePort{
774-
{
775-
Name: "http-1",
776-
Port: 80,
777-
TargetPort: intstr.FromInt(8080),
778-
Protocol: "TCP",
779-
},
780-
}
781-
labels = map[string]string{
782-
"app": "test-loadbalancer",
783-
}
784-
785-
By("Creating Pods")
786-
createPodWithLabel(pods, ports, framework.TestServerImage, labels, false)
787-
788-
By("Creating Service")
789-
createServiceWithSelector(labels, servicePorts, true)
790-
})
791-
792-
AfterEach(func() {
793-
By("Deleting the Pods")
794-
deletePods(pods)
795-
796-
By("Deleting the Service")
797-
deleteService()
798-
})
799-
800-
It("should reach the same pod every time it requests", func() {
801-
By("Checking TCP Response")
802-
var eps []string
803-
Eventually(func() error {
804-
eps, err = f.LoadBalancer.GetLoadBalancerIps()
805-
return err
806-
}).Should(BeNil())
807-
Expect(len(eps)).Should(BeNumerically(">=", 1))
808-
809-
By("Waiting for Response from the LoadBalancer url: " + eps[0])
810-
Eventually(framework.WaitForHTTPResponse).WithArguments(eps[0]).Should(ContainSubstring(""))
811-
})
812-
})
813-
814759
Context("For HTTP body health check", func() {
815760
var (
816761
pods []string

e2e/test/framework/util.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,11 @@ func WaitForHTTPResponse(link string) (string, error) {
173173
}
174174
return "", nil
175175
}
176+
177+
func GetResponseFromCurl(endpoint string) string {
178+
resp, err := exec.Command("curl", "--max-time", "5", "-s", endpoint).Output()
179+
if err != nil {
180+
return ""
181+
}
182+
return string(resp)
183+
}

0 commit comments

Comments
 (0)