Skip to content

Commit 111feea

Browse files
committed
tests: update e2e test for endpointslice compatibility
Signed-off-by: Jayapriya Pai <[email protected]>
1 parent acea385 commit 111feea

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

test/e2e/delete_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,20 @@ func (tc *testContext) checkAWSMetadataEndpointRouteIsRestored(t *testing.T, add
183183
if tc.CloudProvider.GetType() != config.AWSPlatformType {
184184
t.Skipf("Skipping for %s", tc.CloudProvider.GetType())
185185
}
186-
out, err := tc.runPowerShellSSHJob("check-routes", "Get-NetRoute", address)
187-
require.NoError(t, err, "error checking routes")
188-
assert.True(t, strings.Contains(out, "169.254.169.254"), "metadata endpoint route is not restored")
186+
187+
// To allow time for route restoration during node cleanup
188+
// since EndpointSlice discovery may have
189+
// different cleanup timing compared to Endpoints.
190+
err := wait.PollUntilContextTimeout(context.Background(), tc.retryInterval, 2*time.Minute, true,
191+
func(ctx context.Context) (bool, error) {
192+
out, err := tc.runPowerShellSSHJob("check-routes", "Get-NetRoute", address)
193+
if err != nil {
194+
t.Logf("error checking routes (will retry): %v", err)
195+
return false, nil
196+
}
197+
return strings.Contains(out, "169.254.169.254"), nil
198+
})
199+
require.NoError(t, err, "metadata endpoint route was not restored within timeout")
189200
}
190201

191202
// waitForWindowsNodeRemoval returns when there are zero Windows nodes of the given type, machine or byoh, in the cluster

test/e2e/metrics_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,12 @@ func (tc *testContext) testPodMetrics(t *testing.T, podName string) {
239239
fmt.Sprintf("pod_interface_network:container_network_receive_bytes:irate5m{pod='%s',namespace='%s'}", podName, tc.workloadNamespace),
240240
fmt.Sprintf("pod_interface_network:container_network_transmit_bytes_total:irate5m{pod='%s',namespace='%s'}", podName, tc.workloadNamespace),
241241
}
242+
// Use extended timeout to account for EndpointSlice propagation, metric scraping,
243+
// and recording rule evaluation when using EndpointSlice-based service discovery
244+
podMetricsTimeout := 5 * time.Minute
242245
for i, query := range queries {
243246
t.Run("query "+strconv.Itoa(i), func(t *testing.T) {
244-
err := wait.PollUntilContextTimeout(context.TODO(), retry.Interval, retry.ResourceChangeTimeout, true,
247+
err := wait.PollUntilContextTimeout(context.TODO(), retry.Interval, podMetricsTimeout, true,
245248
func(ctx context.Context) (done bool, err error) {
246249
results, err := makePrometheusQuery(prometheusRoute.Spec.Host, query, prometheusToken)
247250
if err != nil {

0 commit comments

Comments
 (0)