Skip to content

Prevent infinite loop in TestAccComputeDisk_imageDiffSuppressPublicVe… #16266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/9273.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
7 changes: 6 additions & 1 deletion google/services/compute/resource_compute_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ func TestAccComputeDisk_imageDiffSuppressPublicVendorsFamilyNames(t *testing.T)

for _, publicImageProject := range tpgcompute.ImageMap {
token := ""
for paginate := true; paginate; {
// Hard limit on number of pages to prevent infinite loops
// caused by the API always returning a pagination token
page := 0
maxPages := 10
for paginate := true; paginate && page < maxPages; {
resp, err := config.NewComputeClient(config.UserAgent).Images.List(publicImageProject).Filter("deprecated.replacement ne .*images.*").PageToken(token).Do()
if err != nil {
t.Fatalf("Can't list public images for project %q", publicImageProject)
Expand All @@ -320,6 +324,7 @@ func TestAccComputeDisk_imageDiffSuppressPublicVendorsFamilyNames(t *testing.T)
}
token := resp.NextPageToken
paginate = token != ""
page++
}
}
}
Expand Down