Skip to content

Commit

Permalink
Don't fail compatibility test when COS versions are not yet released.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zkoopmans authored and gvisor-bot committed Jan 8, 2025
1 parent 2c3974d commit 9803629
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/gpu/cos_gpu_compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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)
}
Expand Down

0 comments on commit 9803629

Please sign in to comment.