fix e2e loadbalancer test timeouts and assumptions

Change-Id: Ie9e30ef8e0b20863210bd4a2b5c12e1709654b76
This commit is contained in:
Antonio Ojea 2024-04-03 08:02:00 +00:00
parent 6673e7a93d
commit 9a40ea2e28
2 changed files with 4 additions and 19 deletions

View File

@ -299,21 +299,21 @@ var _ = common.SIGDescribe("LoadBalancers", func() {
framework.Logf("service port TCP: %d", svcPort) framework.Logf("service port TCP: %d", svcPort)
ginkgo.By("hitting the TCP service's LoadBalancer") ginkgo.By("hitting the TCP service's LoadBalancer")
e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, loadBalancerCreateTimeout) e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, loadBalancerLagTimeout)
ginkgo.By("Scaling the pods to 0") ginkgo.By("Scaling the pods to 0")
err = tcpJig.Scale(ctx, 0) err = tcpJig.Scale(ctx, 0)
framework.ExpectNoError(err) framework.ExpectNoError(err)
ginkgo.By("looking for ICMP REJECT on the TCP service's LoadBalancer") ginkgo.By("hitting the TCP service's LoadBalancer with no backends, no answer expected")
testRejectedHTTP(tcpIngressIP, svcPort, loadBalancerCreateTimeout) testNotReachableHTTP(tcpIngressIP, svcPort, loadBalancerLagTimeout)
ginkgo.By("Scaling the pods to 1") ginkgo.By("Scaling the pods to 1")
err = tcpJig.Scale(ctx, 1) err = tcpJig.Scale(ctx, 1)
framework.ExpectNoError(err) framework.ExpectNoError(err)
ginkgo.By("hitting the TCP service's LoadBalancer") ginkgo.By("hitting the TCP service's LoadBalancer")
e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, loadBalancerCreateTimeout) e2eservice.TestReachableHTTP(ctx, tcpIngressIP, svcPort, loadBalancerLagTimeout)
// Change the services back to ClusterIP. // Change the services back to ClusterIP.

View File

@ -444,21 +444,6 @@ func testNotReachableHTTP(host string, port int, timeout time.Duration) {
} }
} }
// testRejectedHTTP tests that the given host rejects a HTTP request on the given port.
func testRejectedHTTP(host string, port int, timeout time.Duration) {
pollfn := func() (bool, error) {
result := e2enetwork.PokeHTTP(host, port, "/", nil)
if result.Status == e2enetwork.HTTPRefused {
return true, nil
}
return false, nil // caller can retry
}
if err := wait.PollImmediate(framework.Poll, timeout, pollfn); err != nil {
framework.Failf("HTTP service %v:%v not rejected: %v", host, port, err)
}
}
// UDPPokeParams is a struct for UDP poke parameters. // UDPPokeParams is a struct for UDP poke parameters.
type UDPPokeParams struct { type UDPPokeParams struct {
Timeout time.Duration Timeout time.Duration