Conversation
Co-authored-by: Richard Wall <978965+wallrj@users.noreply.github.com>
Co-authored-by: Richard Wall <978965+wallrj@users.noreply.github.com>
There was a problem hiding this comment.
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 <978965+wallrj@users.noreply.github.com>
This is a follow-up PR to #552. I had forgotten to push these few commits before clicking "Merge"... 😨
logthat should have beenlogs.Log.loadRESTConfigfunc (suggested in Richard's comment)./bin/sh: git: not found". The issue is thatgitis missing when the GitHub Action "ssh-agent" runs. Example of failure: https://github.com/jetstack/jetstack-secure/actions/runs/10509465707/job/29115732869