Skip to content

Commit 0748a75

Browse files
committed
e2e TCP CLOSE test wait until pod is ready
the e2e TCP CLOSE_WAIT has to create a server pod and then, from a client, it creates a connection but doesn't notify the server when closing it, so it stays on the CLOSE_WAIT status until it times out. Current test use a simple timeout for waiting the that server pod is ready, it's better to use WaitForPodsReady for waiting that the pod is available to avoid problems on busy environments like the CI. It also deletes the pods once the tests finish to avoid leaking pods.
1 parent 5ea2d69 commit 0748a75

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/e2e/network/kube_proxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,20 @@ var _ = SIGDescribe("Network", func() {
208208
serverNodeInfo.nodeIP,
209209
kubeProxyE2eImage))
210210
fr.PodClient().CreateSync(serverPodSpec)
211+
defer fr.PodClient().DeleteSync(serverPodSpec.Name, metav1.DeleteOptions{}, framework.DefaultPodDeletionTimeout)
211212

212213
// The server should be listening before spawning the client pod
213-
<-time.After(time.Duration(2) * time.Second)
214+
if readyErr := e2epod.WaitForPodsReady(fr.ClientSet, fr.Namespace.Name, serverPodSpec.Name, 0); readyErr != nil {
215+
framework.Failf("error waiting for server pod %s to be ready: %w", serverPodSpec.Name, readyErr)
216+
}
214217
// Connect to the server and leak the connection
215218
ginkgo.By(fmt.Sprintf(
216219
"Launching a client connection on node %v (node ip: %v, image: %v)",
217220
clientNodeInfo.name,
218221
clientNodeInfo.nodeIP,
219222
kubeProxyE2eImage))
220223
fr.PodClient().CreateSync(clientPodSpec)
224+
defer fr.PodClient().DeleteSync(clientPodSpec.Name, metav1.DeleteOptions{}, framework.DefaultPodDeletionTimeout)
221225

222226
ginkgo.By("Checking /proc/net/nf_conntrack for the timeout")
223227
// These must be synchronized from the default values set in

0 commit comments

Comments
 (0)