From 9803629d9240b590c23f0e532d391e14c5fdc725 Mon Sep 17 00:00:00 2001 From: Zach Koopmans Date: Wed, 8 Jan 2025 12:59:06 -0800 Subject: [PATCH] Don't fail compatibility test when COS versions are not yet released. COS can take a day or two to release a new version. While this is happening versions can appear in gcloud projects, but not on the public site. In this case, pass the tests so that we don't have failures while release is happening. PiperOrigin-RevId: 713388040 --- test/gpu/cos_gpu_compatibility_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/gpu/cos_gpu_compatibility_test.go b/test/gpu/cos_gpu_compatibility_test.go index 909436e519..b1c94a46fe 100644 --- a/test/gpu/cos_gpu_compatibility_test.go +++ b/test/gpu/cos_gpu_compatibility_test.go @@ -53,6 +53,8 @@ func TestGPUDriversCompatibility(t *testing.T) { t.Fatalf("Failed to unmarshal image JSON file: %v", err) } + executedTests := 0 + for _, image := range images { name := image["name"].(string) family := image["family"].(string) @@ -95,7 +97,7 @@ func TestGPUDriversCompatibility(t *testing.T) { default: continue } - + executedTests++ if !supportedDrivers[driver.GetVersion()] { t.Errorf("Unsupported driver patch: %q gpu: %q version: %q", driver.GetVersion(), info.GetGpuDevice().GetGpuType(), driver.GetLabel()) continue @@ -106,6 +108,9 @@ func TestGPUDriversCompatibility(t *testing.T) { } }) } + if !t.Failed() && executedTests <= 0 { + t.Fatalf("No successful tests: check logs for details") + } } func imageNameToCosPatchVersion(imageName string, family string) (int, string, error) { @@ -128,6 +133,12 @@ func listedDriverVersions(cosVersion string) ([]byte, error) { // See: https://cloud.google.com/container-optimized-os/docs/release-notes url := fmt.Sprintf("https://storage.googleapis.com/cos-tools/%s/lakitu/gpu_driver_versions.textproto", cosVersion) resp, err := http.Get(url) + // When COS versions are newly released, they will often show up in projects but not the release + // page. In this case, we return an empty list of driver versions. + if resp.StatusCode == 404 { + resp.Body.Close() + return []byte("gpu_driver_version_info: []"), nil + } if err != nil { return nil, fmt.Errorf("failed to get driver versions for release %q: %w", cosVersion, err) }