e2e apps: capture expected state before making changes

Looking up the expected nodes in the goroutine raced with the test making
changes to the configuration. When doing (unrelated?) changes, the test started
to fail:

Oct 23 15:47:03.092: INFO: Unexpected error:
    <*errors.errorString | 0xc001154c70>: {
        s: "no subset of available IP address found for the endpoint test-rolling-update-with-lb within timeout 2m0s",
    }
Oct 23 15:47:03.092: FAIL: no subset of available IP address found for the endpoint test-rolling-update-with-lb within timeout 2m0s
This commit is contained in:
Patrick Ohly 2022-10-25 13:17:11 +02:00
parent 7454c3ff81
commit 2168dd5334

View File

@ -1395,14 +1395,15 @@ func testRollingUpdateDeploymentWithLocalTrafficLoadBalancer(f *framework.Framew
}
e2eservice.TestReachableHTTP(lbNameOrAddress, svcPort, timeout)
expectedNodes, err := jig.GetEndpointNodeNames()
framework.ExpectNoError(err)
framework.Logf("Starting a goroutine to watch the service's endpoints in the background")
done := make(chan struct{})
failed := make(chan struct{})
defer close(done)
go func() {
defer ginkgo.GinkgoRecover()
expectedNodes, err := jig.GetEndpointNodeNames()
framework.ExpectNoError(err)
// The affinity policy should ensure that before an old pod is
// deleted, a new pod will have been created on the same node.
// Thus the set of nodes with local endpoints for the service