-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat: add suit test cases for controller #99
Conversation
Signed-off-by: Aisuko <urakiny@gmail.com>
Hi, @AlexsJones, please take a look at this PR. It is a useful one. |
@Aisuko I found that these tests will indefinitely hang, looks like something occurring in the shutdown sequence?
|
}) | ||
|
||
var _ = AfterSuite(func() { | ||
By("tearing down the test environment") | ||
err := testEnv.Stop() | ||
Expect(err).NotTo(HaveOccurred()) | ||
// Here we need to exit directly because the testEnv.Stop() may hang forever in some cases. | ||
if err != nil { |
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.
@AlexsJones Sometimes, testEnv will stop failing and I hit that issue before. See kubernetes-sigs/controller-runtime#1571 (comment) but I believe they have fixed this issue in this version. Is it anlways indefinitely hanging in your env? My testing env is a codespace with 16core 32GB memory and I set the timeout to 3 minutes. I did not hit this issue.
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.
Mine is an M2 pro, so similar spec - shall we test to see if this hangs the GH action?
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.
I got your point, this PR also change the CI process to make test
. As you can see here are several times successful.
KUBEBUILDER_ASSETS="/home/runner/work/k8sgpt-operator/k8sgpt-operator/bin/k8s/1.26.0-linux-amd64" go test ./... -coverprofile cover.out
? github.com/k8sgpt-ai/k8sgpt-operator [no test files]
ok github.com/k8sgpt-ai/k8sgpt-operator/api/v1alpha1 0.037s coverage: 58.0% of statements
? github.com/k8sgpt-ai/k8sgpt-operator/pkg/client [no test files]
? github.com/k8sgpt-ai/k8sgpt-operator/pkg/common [no test files]
? github.com/k8sgpt-ai/k8sgpt-operator/pkg/resources [no test files]
? github.com/k8sgpt-ai/k8sgpt-operator/pkg/utils [no test files]
ok github.com/k8sgpt-ai/k8sgpt-operator/controllers 66.830s coverage: 25.2% of statements
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.
@AlexsJones Can we merge this one? I have tested this PR in my community's operator. It is without any hang.
Hi @arbreezy This PR is not useful anymore right? |
Closes #
📑 Description
As I mentioned before, this time I add the test cases for the controller. This PR is without the import of any further packages. And all the test cases were passed.
And this PR also updates the CI checking to check run all the test cases.
✅ Checks
ℹ Additional Information