From 9be883f57d6e179635da52b04e9a2ce278e796d0 Mon Sep 17 00:00:00 2001 From: Blocka Date: Tue, 17 Dec 2024 02:51:31 +0800 Subject: [PATCH] [RayService] Use waitGroup to ensure goroutine completion in rayservice_ha_test (#2657) Signed-off-by: win5923 --- ray-operator/test/e2e/rayservice_ha_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ray-operator/test/e2e/rayservice_ha_test.go b/ray-operator/test/e2e/rayservice_ha_test.go index ac48561d82..1b1b1d3698 100644 --- a/ray-operator/test/e2e/rayservice_ha_test.go +++ b/ray-operator/test/e2e/rayservice_ha_test.go @@ -1,6 +1,7 @@ package e2e import ( + "sync" "testing" "time" @@ -173,7 +174,12 @@ func TestRayServiceZeroDowntimeUpgrade(t *testing.T) { ExecPodCmd(test, headPod, common.RayHeadContainer, []string{"pip", "install", "locust"}) // Start a goroutine to perform zero-downtime upgrade + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + test.T().Logf("Waiting several seconds before updating RayService") time.Sleep(30 * time.Second) @@ -196,4 +202,6 @@ func TestRayServiceZeroDowntimeUpgrade(t *testing.T) { ExecPodCmd(test, headPod, common.RayHeadContainer, []string{ "python", "/locust-runner/locust_runner.py", "-f", "/locustfile/locustfile.py", "--host", "http://test-rayservice-serve-svc:8000", }) + + wg.Wait() }