From ed3c7a1dc33d83fb73c0cb77b732cdb0f14e64c7 Mon Sep 17 00:00:00 2001 From: KunWuLuan Date: Tue, 6 Jan 2026 15:32:23 +0800 Subject: [PATCH] Add KuberayTestArch environment variable for architecture override in tests This commit introduces a new environment variable KuberayTestArch that allows overriding the detected architecture in test environments. Previously, the system only relied on runtime.GOARCH to determine if ARM64 architecture was being used, but this change enables explicit architecture specification through the environment variable. This is particularly useful for testing scenarios where you want to force a specific architecture regardless of the actual runtime environment, improving test flexibility and consistency across different platforms. Signed-off-by: KunWuLuan --- ray-operator/test/support/environment.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ray-operator/test/support/environment.go b/ray-operator/test/support/environment.go index 42661be1649..63444856f8c 100644 --- a/ray-operator/test/support/environment.go +++ b/ray-operator/test/support/environment.go @@ -17,6 +17,8 @@ const ( // KuberayTestRayImage is the Ray image to use for testing. KuberayTestRayImage = "KUBERAY_TEST_RAY_IMAGE" + KuberayTestArch = "KUBERAY_TEST_ARCH" + KuberayTestUpgradeImage = "KUBERAY_TEST_UPGRADE_IMAGE" ) @@ -29,7 +31,11 @@ func GetRayImage() string { // detect if we are running on arm64 machine, most likely apple silicon // the os name is not checked as it also possible that it might be linux // also check if the image does not have the `-aarch64` suffix - if runtime.GOARCH == "arm64" && !strings.HasSuffix(rayImage, "-aarch64") { + arch := runtime.GOARCH + if archFromEnv := lookupEnvOrDefault(KuberayTestArch, ""); archFromEnv != "" { + arch = archFromEnv + } + if arch == "arm64" && !strings.HasSuffix(rayImage, "-aarch64") { rayImage = rayImage + "-aarch64" fmt.Printf("Modified Ray Image to: %s for ARM chips\n", rayImage) }