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

Extract testenv #355

Merged
merged 5 commits into from
Oct 13, 2023
Merged

Extract testenv #355

merged 5 commits into from
Oct 13, 2023

Conversation

dbadura
Copy link
Contributor

@dbadura dbadura commented Oct 12, 2023

Description

Changes proposed in this pull request:

  • make testenv configuration to be available in whole serverless component

Related issue(s)
kyma-project/kyma#17562

@kyma-bot kyma-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 12, 2023
@kyma-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kyma-bot kyma-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 12, 2023
@dbadura dbadura marked this pull request as ready for review October 12, 2023 14:10
@kyma-bot kyma-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 12, 2023
Copy link
Contributor

@pPrecel pPrecel left a comment

Choose a reason for hiding this comment

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

Looks ok 👌🏿 only names-related suggestions

"testing"
)

func SetUpTestEnv(t *testing.T) (cl client.Client, env *envtest.Environment) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of the package contains info about the destination of the content. We don't need to keep the same info in the func name. I would suggest renaming the SetUpTestEnv to just SetUp or something like Configure.

Copy link
Contributor

Choose a reason for hiding this comment

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

The testenv_test.SetUpTestEnv(t) looks a bit strange 😅 That's why I suggested changing it into testenv_test.SetUp(t) or, with propositions from the comment below, even into testenv.SetUp(t)/env_test.SetUp(t).

Copy link
Contributor Author

@dbadura dbadura Oct 13, 2023

Choose a reason for hiding this comment

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

I propose names Start and Stop. Those are similar to standard envtest package methods

@@ -0,0 +1,54 @@
package testenv_test
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the testenv_test keeps redundant info. The _test suffix is used to define the desire of the package, right? I would suggest renaming it into env_test.

To be honest, I think the testenv keeps all important information about the content under it, so maybe we even should remove this _test suffix.

But if we don't want to allow importing public methods from this pkg in a non-test file we should add the _test suffix to the file name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not possible to use test file package in other tests I renamed the file to just envtest.
I removed the additional test from package as Start and Stop accept testing.T which indicate that those methods should be used in test only,

@pPrecel pPrecel assigned pPrecel and dbadura and unassigned pPrecel Oct 12, 2023
@dbadura dbadura assigned pPrecel and unassigned dbadura Oct 13, 2023
@dbadura
Copy link
Contributor Author

dbadura commented Oct 13, 2023

/test all

@kyma-bot kyma-bot added the lgtm Looks good to me! label Oct 13, 2023
@kyma-bot kyma-bot merged commit 6b0e2a3 into kyma-project:main Oct 13, 2023
14 checks passed
@dbadura dbadura deleted the extract-testenv branch October 13, 2023 12:04
@Cortey Cortey mentioned this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Looks good to me! size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants