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

Add prerun TestMain function to test utils #5205

Closed
wants to merge 1 commit into from

Conversation

josefkarasek
Copy link
Member

In my individual testing I was using TestVerifyKEDA to wait for keda cluster to come up, but it didn't work because the test didn't have kubernetes client.

Since TestMain is a standard way in go testing to setup test env before the test suite is executed, I think that this change can be beneficial for other keda users.

Checklist

Relates to #

Signed-off-by: Josef Karasek <[email protected]>
@josefkarasek josefkarasek requested a review from a team as a code owner November 24, 2023 10:12
Copy link

Thank you for your contribution! 🙏 We will review your PR as soon as possible.

While you are waiting, make sure to:

Learn more about:

Copy link
Member

@wozniakjan wozniakjan left a comment

Choose a reason for hiding this comment

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

lgtm

}
return KubeClient, nil
}

func GetKedaKubernetesClient(t *testing.T) *v1alpha1.KedaV1alpha1Client {
Copy link
Member

Choose a reason for hiding this comment

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

I will take a look later if I can manage to remove this call from all tests so the test setup logic is in a single place

. "github.com/kedacore/keda/v2/tests/helper"
)

func TestMain(m *testing.M) {
Copy link
Member

Choose a reason for hiding this comment

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

might be interesting to see if we can move this to either helper package or some common test package later

@JorTurFer
Copy link
Member

JorTurFer commented Nov 24, 2023

Hello,
I don't see the issue, how is this impacting you? I mean, you do need a valid kubeconfig for executing the e2e tests, the KubeClient is 100% required (not this specific clientset, but a valid KubeClient is mandatory). The helper is just that, a helper for getting the clientset during e2e tests but it's only required on a few e2e tests.
Am I missing something?

Copy link

stale bot commented Jan 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Jan 24, 2024
@zroubalik
Copy link
Member

Do we have any update on this?

@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Jan 29, 2024
@josefkarasek
Copy link
Member Author

The use case for this is too narrow, so closing the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants