Skip to content

Commit

Permalink
add e2e case for updating service.beta.kubernetes.io/azure-dns-label-…
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
MartinForReal committed Oct 31, 2022
1 parent 8575eb9 commit 94a14cb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/e2e/network/service_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,38 @@ var _ = Describe("Service with annotation", Label(utils.TestSuiteLabelServiceAnn
time.Sleep(20 * time.Second)
}
Expect(code).To(Equal(nginxStatusCode), "Fail to get response from the domain name")
By("Update service")
annotation = map[string]string{
consts.ServiceAnnotationDNSLabelName: serviceDomainNamePrefix + "new",
}
service := utils.CreateLoadBalancerServiceManifest(serviceName, annotation, labels, ns.Name, ports)
_, err := cs.CoreV1().Services(ns.Name).Update(context.TODO(), service, metav1.UpdateOptions{})
Expect(err).NotTo(HaveOccurred())
var code int
serviceDomainName = utils.GetServiceDomainName(serviceDomainNamePrefix)
url = fmt.Sprintf("http://%s:%v", serviceDomainName, ports[0].Port)
for i := 1; i <= 30; i++ {
/* #nosec G107: Potential HTTP request made with variable url */
resp, err := http.Get(url)
if err == nil {
defer func() {
if resp != nil {
resp.Body.Close()
}
}()
code = resp.StatusCode
if code == nginxStatusCode {
break
} else {
utils.Logf("Received %d status code from %s", code, url)
}
} else {
utils.Logf("Received the following error when validating %s: %v", url, err)
}
utils.Logf("Retrying in 20 seconds")
time.Sleep(20 * time.Second)
}
Expect(code).To(Equal(nginxStatusCode), "Fail to get response from the domain name")
})

It("should support service annotation 'service.beta.kubernetes.io/azure-load-balancer-internal'", func() {
Expand Down

0 comments on commit 94a14cb

Please sign in to comment.