Leftover processes after running make test#561
Merged
Conversation
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>
3 tasks
maelvls
commented
Aug 23, 2024
Comment on lines
+338
to
+344
| // If KUBEBUILDER_ASSETS isn't set, show a warning to the user. | ||
| if os.Getenv("KUBEBUILDER_ASSETS") == "" { | ||
| t.Fatalf("KUBEBUILDER_ASSETS isn't set. You can run this test using `make test`.\n" + | ||
| "But if you prefer not to use `make`, run these two commands first:\n" + | ||
| " make _bin/tools/{kube-apiserver,etcd}\n" + | ||
| " export KUBEBUILDER_ASSETS=$PWD/_bin/tools") | ||
| } |
Member
Author
There was a problem hiding this comment.
I was slightly annoyed that running go test would always end up with the unhelpful message:
unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
So I added this quick fix to help whoever is running this test to sort things out.
wallrj
approved these changes
Aug 23, 2024
Member
wallrj
left a comment
There was a problem hiding this comment.
Thanks @maelvls
I tried it and it worked.
$ go test ./pkg/client/...
--- FAIL: TestVenConnClient_PostDataReadingsWithOptions (0.00s)
--- FAIL: TestVenConnClient_PostDataReadingsWithOptions/valid_accessToken (0.00s)
client_venconn_test.go:340: KUBEBUILDER_ASSETS isn't set. You can run this test using `make test`.
But if you prefer not to use `make`, run these two commands first:
make _bin/tools/{kube-apiserver,etcd}
export KUBEBUILDER_ASSETS=$PWD/_bin/tools
--- FAIL: TestVenConnClient_PostDataReadingsWithOptions/error_when_the_apiKey_field_is_used (0.00s)
client_venconn_test.go:340: KUBEBUILDER_ASSETS isn't set. You can run this test using `make test`.
But if you prefer not to use `make`, run these two commands first:
make _bin/tools/{kube-apiserver,etcd}
export KUBEBUILDER_ASSETS=$PWD/_bin/tools
--- FAIL: TestVenConnClient_PostDataReadingsWithOptions/error_when_the_tpp_field_is_used (0.00s)
client_venconn_test.go:340: KUBEBUILDER_ASSETS isn't set. You can run this test using `make test`.
But if you prefer not to use `make`, run these two commands first:
make _bin/tools/{kube-apiserver,etcd}
export KUBEBUILDER_ASSETS=$PWD/_bin/tools
FAIL
FAIL github.com/jetstack/preflight/pkg/client 0.026s
FAIL
$ make _bin/tools/{kube-apiserver,etcd}
make: '_bin/tools/kube-apiserver' is up to date.
make: '_bin/tools/etcd' is up to date.
$ export KUBEBUILDER_ASSETS=$PWD/_bin/tools
$ go test ./pkg/client/...
ok github.com/jetstack/preflight/pkg/client 18.790s
/approve
/lgtm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Credit for identifying this bug and fixing goes to Richard Wall in (1).