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

🐛 Fix flaky TestGetWorkloadCluster test #5223

Merged
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
4 changes: 3 additions & 1 deletion controlplane/kubeadm/internal/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ func TestGetWorkloadCluster(t *testing.T) {
}(o)
}

Copy link
Member Author

@sbueringer sbueringer Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test regularly fails in the second case returns error if cannot get rest.Config from kubeconfigSecret.

I think that's because between the first and second case the deletion of the kubeconfigSecret is sometimes not reflected in the local cache fast enough.

I think for the purpose of the test it's fine to use the live client.

// Note: The API reader is intentionally used instead of the regular (cached) client
// to avoid test failures when the local cache isn't able to catch up in time.
m := Management{
Client: env,
Client: env.GetAPIReader(),
Tracker: tracker,
}

Expand Down