commands,pkg/test: support single namespace mode for local test#546
Merged
AlexNPavel merged 6 commits intoSep 28, 2018
Merged
Conversation
This commit brings support for running the tests in a single namespace when using `test local`, which was previously only used by `test cluster` (where it was a requirement to properly function)
Contributor
Author
|
Changed to WIP because needs docs |
Contributor
Author
|
Docs updated |
hasbro17
reviewed
Sep 28, 2018
| } | ||
| if Global.InCluster { | ||
| if *Global.SingleNamespace { | ||
| ctx.Namespace = os.Getenv(TestNamespaceEnv) |
Contributor
There was a problem hiding this comment.
Check if env is set and is not empty otherwise return error. We always expect len(os.Getenv(TestNamespaceEnv)) >0 for the single namespace case.
hasbro17
reviewed
Sep 28, 2018
| err = wait.PollImmediate(time.Second, time.Second*10, func() (done bool, err error) { | ||
| if Global.InCluster { | ||
| if *Global.SingleNamespace { | ||
| err = Global.DynamicClient.List(goctx.TODO(), &dynclient.ListOptions{Namespace: os.Getenv(TestNamespaceEnv)}, obj) |
Contributor
There was a problem hiding this comment.
Instead of doing os.Getenv(TestNamespaceEnv) wherever it's needed, let's initialize a Namespace field to the framework.
During the framework setup() we check this once (if singleNamespace=true) and set Global.Namespace=<namespace>.
Contributor
|
LGTM |
johnkim76
pushed a commit
to dymurray/operator-sdk
that referenced
this pull request
Oct 2, 2018
…ator-framework#546) * commands,pkg/test: support single namespace mode for local test This commit brings support for running the tests in a single namespace when using `test local`, which was previously only used by `test cluster` (where it was a requirement to properly function) * doc: update docs with new test local --namespace flag * pkg/test/resource_creator.go: check namespace env value * pkg/test: change handling of TestNamespaceEnv
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.
This commit brings support for running the tests in a single
namespace when using
test local, which was previously only usedby
test cluster(where it was a requirement to properly function)/cc @hasbro17 @fanminshi