e2e network: adapt dual stack tests for endpoint slices only

This commit is contained in:
Antonio Ojea 2025-01-22 10:19:45 +00:00
parent a78983906f
commit db3ae754b1

View File

@ -863,10 +863,14 @@ func (config *NetworkingTestConfig) setup(ctx context.Context, selector map[stri
}
ginkgo.By("Waiting for NodePort service to expose endpoint")
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, nodePortServiceName, len(config.EndpointPods), time.Second, wait.ForeverTestTimeout)
numEndpoints := len(config.EndpointPods)
if config.DualStackEnabled {
numEndpoints = 2 * len(config.EndpointPods)
}
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, nodePortServiceName, numEndpoints, time.Second, wait.ForeverTestTimeout)
framework.ExpectNoError(err, "failed to validate endpoints for service %s in namespace: %s", nodePortServiceName, config.Namespace)
ginkgo.By("Waiting for Session Affinity service to expose endpoint")
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, sessionAffinityServiceName, len(config.EndpointPods), time.Second, wait.ForeverTestTimeout)
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, sessionAffinityServiceName, numEndpoints, time.Second, wait.ForeverTestTimeout)
framework.ExpectNoError(err, "failed to validate endpoints for service %s in namespace: %s", sessionAffinityServiceName, config.Namespace)
}
@ -916,7 +920,11 @@ func (config *NetworkingTestConfig) DeleteNetProxyPod(ctx context.Context) {
framework.Failf("Failed to delete %s pod: %v", pod.Name, err)
}
// wait for endpoint being removed.
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, nodePortServiceName, len(config.EndpointPods), time.Second, wait.ForeverTestTimeout)
numEndpoints := len(config.EndpointPods)
if config.DualStackEnabled {
numEndpoints = 2 * len(config.EndpointPods)
}
err = framework.WaitForServiceEndpointsNum(ctx, config.f.ClientSet, config.Namespace, nodePortServiceName, numEndpoints, time.Second, wait.ForeverTestTimeout)
if err != nil {
framework.Failf("Failed to remove endpoint from service: %s", nodePortServiceName)
}