Skip to content
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

🌱 DumpResourcesForCluster should fail fast for i/o errors #10238

Merged
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
14 changes: 14 additions & 0 deletions test/framework/alltypes_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ func DumpResourcesForCluster(ctx context.Context, input DumpResourcesForClusterI
for _, resource := range input.Resources {
resourceList := new(unstructured.UnstructuredList)
resourceList.SetGroupVersionKind(resource.GVK)

var i int
var listErr error
_ = wait.PollUntilContextTimeout(ctx, retryableOperationInterval, retryableOperationTimeout, true, func(ctx context.Context) (bool, error) {
if listErr = input.Lister.List(ctx, resourceList, client.InNamespace(resource.Namespace)); listErr != nil {
Expand All @@ -165,6 +167,18 @@ func DumpResourcesForCluster(ctx context.Context, input DumpResourcesForClusterI
if strings.HasSuffix(listErr.Error(), "connect: no route to host") {
return true, nil
}
// e.g This error happens when the API server for the workload cluster is down or the control plane endpoint
// can't be reached from the machine where the E2E test runs.
// NOTE: we consider this error won't recover after it happens at least 3 times in a row
if strings.HasSuffix(listErr.Error(), "i/o timeout") {
i++
if i >= 3 {
return true, nil
}
return false, nil
}

i = 0
return false, nil
}
return true, nil
Expand Down