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

fix: create namespace when running TestSuite #518

Merged
merged 1 commit into from
May 20, 2024

Conversation

chenmj11
Copy link
Contributor

@chenmj11 chenmj11 commented May 8, 2024

What this PR does / why we need it:

The tests in a TestSuite fail, because the specified namespace does not exist.

kuttl-test.yaml

apiVersion: kuttl.dev/v1beta1
kind: TestSuite
namespace: test
timeout: 60
reportName: test
reportFormat: JSON 

error logs

    logger.go:42: 13:48:07 | pod | Ignoring pod-assert.yaml as it does not match file name regexp: ^(\d+)-(?:[^\.]+)(?:\.yaml)?$  
    logger.go:42: 13:48:07 | pod | Ignoring pod.yaml as it does not match file name regexp: ^(\d+)-(?:[^\.]+)(?:\.yaml)?$  
    logger.go:42: 13:48:07 | pod | Skipping creation of user-supplied namespace: test  
    logger.go:42: 13:48:07 | pod/0-step | starting test step 0-step  
    case.go:366: failed in step 0-step  
    case.go:368: namespaces "test" not found  

*Automatically closes linked issue when PR is merged.
Fixes 512

@chenmj11 chenmj11 force-pushed the bug-fix branch 2 times, most recently from e97f0de to ff6bc51 Compare May 8, 2024 07:35
Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!
I think this looks good apart from the hiding of error.

pkg/test/case.go Outdated Show resolved Hide resolved
pkg/test/case.go Outdated Show resolved Hide resolved
Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

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

Nice! Just a few more nitpicks and this will be good to merge.

pkg/test/case.go Outdated Show resolved Hide resolved
pkg/test/case.go Show resolved Hide resolved
pkg/test/case.go Outdated Show resolved Hide resolved
Signed-off-by: chenmj11 <chenmj11@lenovo.com>
@porridge
Copy link
Member

Looking closer at this, the determineNamespace() call should probably be made using all clients once their list is populated a bit later. Otherwise we risk creating the ns on some clusters but not others, in case we get an error because the namespace already exists on some of them.

However I'm going to merge this now since it's already an improvement in the common single-cluster case.

Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @chenmj11 !

@porridge porridge merged commit 022d2c1 into kudobuilder:main May 20, 2024
4 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specified test namespace not created when running TestSuite
2 participants