-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feedback from #552 #560
Feedback from #552 #560
Conversation
Co-authored-by: Richard Wall <[email protected]>
Co-authored-by: Richard Wall <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @maelvls
There was also the t.Cleanup(envtest.Stop())
suggestion, but that can be done in another PR if you prefer (and if you agree that it is desired and causing orphan etcd , kube-apiserver processes to be left behind)
I will investigate this now: |
Apologies. I didn't see the envtest.Stop code and I jumped to a conclusion. I think the problem orphan processes happened when I was fixing the loading of the envtest CRDs. diff --git a/pkg/client/client_venconn_test.go b/pkg/client/client_venconn_test.go
index 7e7790a..7177b4a 100644
--- a/pkg/client/client_venconn_test.go
+++ b/pkg/client/client_venconn_test.go
@@ -336,16 +336,15 @@ func fakeTPP(t testing.TB) (*httptest.Server, *x509.Certificate) {
func startEnvtest(t testing.TB) (_ *envtest.Environment, _ *rest.Config, kclient ctrlruntime.WithWatch) {
envtest := &envtest.Environment{
ErrorIfCRDPathMissing: true,
- CRDDirectoryPaths: []string{"../../deploy/charts/venafi-kubernetes-agent/crd_bases/jetstack.io_venaficonnections.yaml"},
+ CRDDirectoryPaths: []string{"../../deploy/charts/venafi-kubernetes-agent/crd_bases/jetstack.io_venaficonnections.yamlX"},
}
restconf, err := envtest.Start()
- require.NoError(t, err)
-
t.Cleanup(func() {
t.Log("Waiting for envtest to exit")
err = envtest.Stop()
require.NoError(t, err)
})
+ require.NoError(t, err)
sch := runtime.NewScheme()
_ = v1alpha1.AddToScheme(sch) |
You are correct, the left over processes were caused by the test exiting before |
Sometimes (for example when the CRD file isn't found), the test would stop immediately after envtest.Start, meaning that the t.Cleanup block wouldn't run and the two new processes would be left over after the test process would end. The credit for identifying this bug and fixing goes to Richard Wall in [1]. [1]: #560 (comment) Co-authored-by: Richard Wall <[email protected]>
This is a follow-up PR to #552. I had forgotten to push these few commits before clicking "Merge"... 😨
log
that should have beenlogs.Log
.loadRESTConfig
func (suggested in Richard's comment)./bin/sh: git: not found
". The issue is thatgit
is missing when the GitHub Action "ssh-agent" runs. Example of failure: https://github.com/jetstack/jetstack-secure/actions/runs/10509465707/job/29115732869