From f5049523da04b66c527a41af0b7f70dab25fb4e6 Mon Sep 17 00:00:00 2001 From: User Date: Wed, 20 May 2026 09:46:04 +0800 Subject: [PATCH] test(scale): perform cascading cleanup before teardown to prevent cluster pollution Signed-off-by: User --- operator/e2e/tests/scale/main_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/operator/e2e/tests/scale/main_test.go b/operator/e2e/tests/scale/main_test.go index b566fa034..5935ce2f9 100644 --- a/operator/e2e/tests/scale/main_test.go +++ b/operator/e2e/tests/scale/main_test.go @@ -24,6 +24,7 @@ import ( "os" "strconv" "testing" + "time" "github.com/ai-dynamo/grove/operator/e2e/k8s/k8sclient" "github.com/ai-dynamo/grove/operator/e2e/measurement" @@ -64,6 +65,15 @@ func TestMain(m *testing.M) { code := m.Run() + // Perform a final cascading cleanup before tearing down the cluster to prevent + // resource leakage when the cluster is reused for subsequent tests. + // We use a 5-minute timeout as a safe upper bound; internal operations have their own stricter timeouts. + cleanupCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + if err := sharedCluster.CleanupWorkloads(cleanupCtx, true); err != nil { + Logger.Errorf("Final cascading cleanup failed: %v", err) + } + sharedCluster.Teardown() os.Exit(code)