Skip to content

Commit

Permalink
Add test for LoadBalancer Service for HTTP status health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Fahim Abrar committed May 3, 2019
1 parent c2d76c4 commit ac2c1c2
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions e2e/test/ccm_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ var _ = Describe("CloudControllerManager", func() {
)

BeforeEach(func() {
pods = []string{"test-pod"}
pods = []string{"test-pod-http"}
ports := []core.ContainerPort{
{
Name: "http-1",
Expand Down Expand Up @@ -525,7 +525,7 @@ var _ = Describe("CloudControllerManager", func() {
body = "nginx"
)
BeforeEach(func() {
pods = []string{"test-pod"}
pods = []string{"test-pod-http-body"}
ports := []core.ContainerPort{
{
Name: "http",
Expand Down Expand Up @@ -579,7 +579,7 @@ var _ = Describe("CloudControllerManager", func() {
)

BeforeEach(func() {
pods = []string{"test-pod"}
pods = []string{"test-pod-node-add"}
ports := []core.ContainerPort{
{
Name: "http-1",
Expand Down Expand Up @@ -634,7 +634,7 @@ var _ = Describe("CloudControllerManager", func() {
attempts = "4"
)
BeforeEach(func() {
pods = []string{"test-pod"}
pods = []string{"test-pod-tcp"}
ports := []core.ContainerPort{
{
Name: "http",
Expand Down Expand Up @@ -692,7 +692,7 @@ var _ = Describe("CloudControllerManager", func() {
checkPassive = "true"
)
BeforeEach(func() {
pods = []string{"test-pod"}
pods = []string{"test-pod-passive-hc"}
ports := []core.ContainerPort{
{
Name: "http",
Expand Down Expand Up @@ -736,6 +736,62 @@ var _ = Describe("CloudControllerManager", func() {
checkNodeBalancerConfig(checkType, "", "", "", "", "", checkPassive)
})
})

Context("For HTTP Status Health Check", func() {
var (
pods []string
labels map[string]string
annotations map[string]string

checkType = "http"
path = "/"
)
BeforeEach(func() {
pods = []string{"test-pod-http-status"}
ports := []core.ContainerPort{
{
Name: "http",
ContainerPort: 80,
},
}
servicePorts := []core.ServicePort{
{
Name: "http",
Port: 80,
TargetPort: intstr.FromInt(80),
Protocol: "TCP",
},
}

labels = map[string]string{
"app": "test-loadbalancer",
}
annotations = map[string]string{
annLinodeHealthCheckType: checkType,
annLinodeCheckPath: path,
annLinodeProtocol: "http",
}

By("Creating Pod")
createPodWithLabel(pods, ports, "nginx", labels, false)

By("Creating Service")
createServiceWithAnnotations(labels, annotations, servicePorts, false)
})

AfterEach(func() {
By("Deleting the Pods")
deletePods(pods)

By("Deleting the Service")
deleteService()
})

It("should successfully check the health of 2 nodes", func() {
By("Checking NodeBalancer Configurations")
checkNodeBalancerConfig(checkType, path, "", "", "", "", "")
})
})
})
})
})

0 comments on commit ac2c1c2

Please sign in to comment.