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 TestProcessKubeCSR #10355

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Fix Flaky TestProcessKubeCSR #10355

merged 1 commit into from
Feb 15, 2022

Conversation

jimbishopp
Copy link
Contributor

The TestProcessKubeCSR test in lib/auth fails intermittently due to the Kubernetes feature being disabled. The test expects a NotFound error but receives an invalid license error instead. Usually other tests enable the Kubernetes feature before this test runs, but occasionally the test executes without Kubernetes and fails.

This change explicitly enables the Kubernetes feature by generalizing a pattern for setting module features used by the TestDesktopAccessDisabled test.

The following is the location where the test failed and the output received.

_, err = s.a.ProcessKubeCSR(csr)
require.Error(t, err)
require.True(t, trace.IsNotFound(err), "got: %v", err) // failure
=== CONT  TestProcessKubeCSR
kube_test.go:69: 
  Error Trace:	kube_test.go:69
  Error:      	Should be true
  Test:       	TestProcessKubeCSR
  Messages:   	got: this Teleport cluster is not licensed for Kubernetes, please contact the cluster administrator

Flaky Test Tracker: #9492

Explicity set Kubernetes feature for the test.

The test requires the Kubernetes feature to be enabled while not
explicitly enabling it on its own. Sometimes it is enabled and other
times it is not, resulting in an error.
Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

Global state strikes again.

@zmb3
Copy link
Collaborator

zmb3 commented Feb 15, 2022

@jimbishopp do we need to do this in more places? A quick search for SetModules uncovers uses in hsm_test.go, tls_test.go, keystore_test.go, and a bunch more..

@jimbishopp jimbishopp merged commit 7767b8b into master Feb 15, 2022
@jimbishopp jimbishopp deleted the jim/fixkubetest branch February 15, 2022 00:55
@jimbishopp
Copy link
Contributor Author

@zmb3 Yeah, we probably should. I'll find the others and update them in a new PR.

@jimbishopp jimbishopp mentioned this pull request Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants