Skip to content

Commit 6cad098

Browse files
committed
Add --watch-namespace to operator-sdk test local sub-command
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
1 parent c47f57d commit 6cad098

File tree

14 files changed

+87
-55
lines changed

14 files changed

+87
-55
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
### Added
44
- Support for vars in top level ansible watches. ([#2147](https://github.com/operator-framework/operator-sdk/pull/2147))
55

6+
- Added `--watch-namespace` flag as `operator-sdk test local <test-dir> --up-local` command. ([#2149](https://github.com/operator-framework/operator-sdk/pull/2149))
7+
68
### Changed
9+
710
- Upgrade minimal Ansible version in the init projects from `2.4` to `2.6`. ([#2107](https://github.com/operator-framework/operator-sdk/pull/2107))
11+
- **Breaking Change:** Renamed `--namespace` flag as `--watch-namespace` in `operator-sdk up local` command. ([#2149](https://github.com/operator-framework/operator-sdk/pull/2149))
12+
- **Breaking Change:** Renamed `--namespace` flag as `--deploy-namespace` in `operator-sdk test local <test-dir> --up-local` command. ([#2149](https://github.com/operator-framework/operator-sdk/pull/2149))
813

914
### Deprecated
1015

cmd/operator-sdk/test/local.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type testLocalConfig struct {
4848
goTestFlags string
4949
moleculeTestFlags string
5050
deployNamespace string
51+
watchNamespace string
5152
upLocal bool
5253
noSetup bool
5354
debug bool
@@ -69,6 +70,7 @@ func newTestLocalCmd() *cobra.Command {
6970
testCmd.Flags().StringVar(&tlConfig.goTestFlags, "go-test-flags", "", "Additional flags to pass to go test")
7071
testCmd.Flags().StringVar(&tlConfig.moleculeTestFlags, "molecule-test-flags", "", "Additional flags to pass to molecule test")
7172
testCmd.Flags().StringVar(&tlConfig.deployNamespace, "deploy-namespace", "", "If non-empty, single namespace to run tests in (deploys namespaced resources here)")
73+
testCmd.Flags().StringVar(&tlConfig.watchNamespace, "watch-namespace", "", "The namespace where the operator watches for changes (with --up-local, if not set, watches deployNamespace")
7274
testCmd.Flags().BoolVar(&tlConfig.upLocal, "up-local", false, "Enable running operator locally with go run instead of as an image in the cluster")
7375
testCmd.Flags().BoolVar(&tlConfig.noSetup, "no-setup", false, "Disable test resource creation")
7476
testCmd.Flags().BoolVar(&tlConfig.debug, "debug", false, "Enable debug-level logging")
@@ -103,7 +105,7 @@ func testLocalAnsibleFunc(cmd *cobra.Command, args []string) error {
103105
}
104106

105107
dc := exec.Command("molecule", testArgs...)
106-
dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", test.TestNamespaceEnv, tlConfig.deployNamespace))
108+
dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", test.TestDeployNamespaceEnv, tlConfig.deployNamespace))
107109
dc.Dir = projutil.MustGetwd()
108110
return projutil.ExecCmd(dc)
109111
}
@@ -209,14 +211,21 @@ func testLocalGoFunc(cmd *cobra.Command, args []string) error {
209211
if tlConfig.deployNamespace != "" || tlConfig.noSetup {
210212
testArgs = append(testArgs, "-"+test.SingleNamespaceFlag, "-parallel=1")
211213
}
212-
env := append(os.Environ(), fmt.Sprintf("%v=%v", test.TestNamespaceEnv, tlConfig.deployNamespace))
214+
env := append(os.Environ(), fmt.Sprintf("%v=%v", test.TestDeployNamespaceEnv, tlConfig.deployNamespace))
213215
if tlConfig.upLocal {
214216
env = append(env, fmt.Sprintf("%s=%s", k8sutil.ForceRunModeEnv, k8sutil.LocalRunMode))
215217
testArgs = append(testArgs, "-"+test.LocalOperatorFlag)
216218
if tlConfig.localOperatorFlags != "" {
217219
testArgs = append(testArgs, "-"+test.LocalOperatorArgs, tlConfig.localOperatorFlags)
218220
}
219221
}
222+
// if watch-namespace is not explicitly set
223+
// then set test.WatchDeployNamespaceFlag
224+
// so that watchNamespace == deployNamespace in --up-local mode
225+
if tlConfig.upLocal && !cmd.Flags().Changed("watch-namespace") {
226+
testArgs = append(testArgs, "-"+test.WatchDeployNamespaceFlag)
227+
}
228+
env = append(env, fmt.Sprintf("%v=%v", test.TestWatchNamespaceEnv, tlConfig.watchNamespace))
220229
opts := projutil.GoTestOptions{
221230
GoCmdOptions: projutil.GoCmdOptions{
222231
PackagePath: args[0] + "/...",

doc/cli/operator-sdk_test_local.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ operator-sdk test local <path to tests directory> [flags]
1414

1515
```
1616
--debug Enable debug-level logging
17+
--deploy-namespace string If non-empty, single namespace to run tests in (deploys namespaced resources here)
1718
--global-manifest string Path to manifest for Global resources (e.g. CRD manifests)
1819
--go-test-flags string Additional flags to pass to go test
1920
-h, --help help for local
2021
--image string Use a different operator image from the one specified in the namespaced manifest
2122
--kubeconfig string Kubeconfig path
2223
--local-operator-flags string The flags that the operator needs (while using --up-local). Example: "--flag1 value1 --flag2=value2"
2324
--molecule-test-flags string Additional flags to pass to molecule test
24-
--namespace string If non-empty, single namespace to run tests in
2525
--namespaced-manifest string Path to manifest for per-test, namespaced resources (e.g. RBAC and Operator manifest)
2626
--no-setup Disable test resource creation
2727
--up-local Enable running operator locally with go run instead of as an image in the cluster
28+
--watch-namespace string The namespace where the operator watches for changes (with --up-local, if not set, watches deployNamespace
2829
```
2930

3031
### SEE ALSO

doc/cli/operator-sdk_up_local.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ operator-sdk up local [flags]
1616
### Options
1717

1818
```
19-
--enable-delve Start the operator using the delve debugger
20-
--go-ldflags string Set Go linker options
21-
-h, --help help for local
22-
--kubeconfig string The file path to kubernetes configuration file; defaults to location specified by $KUBECONFIG with a fallback to $HOME/.kube/config if not set
23-
--namespace string The namespace where the operator watches for changes.
24-
--operator-flags string The flags that the operator needs. Example: "--flag1 value1 --flag2=value2"
19+
--enable-delve Start the operator using the delve debugger
20+
--go-ldflags string Set Go linker options
21+
-h, --help help for local
22+
--kubeconfig string The file path to kubernetes configuration file; defaults to location specified by $KUBECONFIG with a fallback to $HOME/.kube/config if not set
23+
--operator-flags string The flags that the operator needs. Example: "--flag1 value1 --flag2=value2"
24+
--watch-namespace string The namespace where the operator watches for changes.
2525
```
2626

2727
### SEE ALSO

doc/sdk-cli-reference.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ Runs the tests locally
460460
* `--kubeconfig` string - location of kubeconfig for Kubernetes cluster (default "~/.kube/config")
461461
* `--global-manifest` string - path to manifest for global resources (default "deploy/crd.yaml)
462462
* `--namespaced-manifest` string - path to manifest for per-test, namespaced resources (default: combines deploy/service_account.yaml, deploy/rbac.yaml, and deploy/operator.yaml)
463-
* `--namespace` string - if non-empty, single namespace to run tests in (e.g. "operator-test") (default: "")
463+
* `--deploy-namespace` string - if non-empty, single namespace to run tests in (e.g. "operator-test") (default: "default")
464+
* `--watch-namespace` string - if set, namespace which operator watches while testing with `--up-local`. if set to "", operator watches AllNamespaces. if not set while testing with `--up-local` operator watches deploy-namespace
464465
* `--go-test-flags` string - Additional flags to pass to go test
465466
* `--molecule-test-flags` string - Additional flags to pass to molecule test
466467
* `--up-local` - enable running operator locally with go run instead of as an image in the cluster
@@ -500,7 +501,7 @@ the operator-sdk binary itself as the operator.
500501
* `--enable-delve` bool - starts the operator locally and enables the delve debugger listening on port 2345
501502
* `--go-ldflags` string - Set Go linker options
502503
* `--kubeconfig` string - The file path to Kubernetes configuration file; defaults to $HOME/.kube/config
503-
* `--namespace` string - The namespace where the operator watches for changes. (default "default")
504+
* `--watch-namespace` string - The namespace where the operator watches for changes. (default "default"). set to `""` to watch All-Namepsaces
504505
* `--operator-flags` string - Flags that the local operator may need.
505506
* `-h, --help` - help for local
506507

doc/test-framework/writing-e2e-tests.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ $ operator-sdk test local ./test/e2e --image quay.io/example/my-operator:v0.0.2
239239

240240
### Namespace Flag
241241

242-
If you wish to run all the tests in 1 namespace (which also forces `-parallel=1`), you can use the `--namespace` flag:
242+
If you wish to run all the tests in 1 namespace (which also forces `-parallel=1`), you can use the `--deploy-namespace` flag:
243243

244244
```shell
245245
$ kubectl create namespace operator-test
246-
$ operator-sdk test local ./test/e2e --namespace operator-test
246+
$ operator-sdk test local ./test/e2e --deploy-namespace operator-test
247247
```
248248

249249
### Up-Local Flag
@@ -252,11 +252,11 @@ To run the operator itself locally during the tests instead of starting a deploy
252252
`--up-local` flag. This mode will still create global resources, but by default will not create any in-cluster namespaced
253253
resources unless the user specifies one through the `--namespaced-manifest` flag.
254254

255-
**NOTE**: The `--up-local` flag requires the `--namespace` flag and the command will NOT create the namespace. Then, be sure that you are specifying a valid namespace.
255+
**NOTE**: The `--up-local` flag requires the `--deploy-namespace` flag and the command will NOT create the namespace. Then, be sure that you are specifying a valid namespace.
256256

257257
```shell
258258
$ kubectl create namespace operator-test
259-
$ operator-sdk test local ./test/e2e --namespace operator-test --up-local
259+
$ operator-sdk test local ./test/e2e --deploy-namespace operator-test --up-local
260260
```
261261

262262
### No-Setup Flag
@@ -269,7 +269,7 @@ $ kubectl create -f deploy/service_account.yaml --namespace operator-test
269269
$ kubectl create -f deploy/role.yaml --namespace operator-test
270270
$ kubectl create -f deploy/role_binding.yaml --namespace operator-test
271271
$ kubectl create -f deploy/operator.yaml --namespace operator-test
272-
$ operator-sdk test local ./test/e2e --namespace operator-test --no-setup
272+
$ operator-sdk test local ./test/e2e --deploy-namespace operator-test --no-setup
273273
```
274274

275275
For more documentation on the `operator-sdk test local` command, see the [SDK CLI Reference][sdk-cli-ref] doc.

doc/user-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export OPERATOR_NAME=memcached-operator
303303
Run the operator locally with the default Kubernetes config file present at `$HOME/.kube/config`:
304304

305305
```sh
306-
$ operator-sdk up local --namespace=default
306+
$ operator-sdk up local --watch-namespace=default
307307
2018/09/30 23:10:11 Go Version: go1.10.2
308308
2018/09/30 23:10:11 Go OS/Arch: darwin/amd64
309309
2018/09/30 23:10:11 operator-sdk Version: 0.0.6+git

hack/tests/e2e-ansible-molecule.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pushd memcached-operator
5252
# The following code is the default used (Not valid for MacOSX)
5353
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
5454
OPERATORDIR="$(pwd)"
55-
TEST_CLUSTER_PORT=24443 operator-sdk test local --namespace default
55+
TEST_CLUSTER_PORT=24443 operator-sdk test local --deploy-namespace default
5656

5757
remove_prereqs
5858

@@ -65,6 +65,6 @@ pushd "${ROOTDIR}/test/ansible-inventory"
6565
# sed -i "" 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
6666
# The following code is the default used (Not valid for MacOSX)
6767
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
68-
TEST_CLUSTER_PORT=24443 operator-sdk test local --namespace default
68+
TEST_CLUSTER_PORT=24443 operator-sdk test local --deploy-namespace default
6969

7070
popd

hack/tests/subcommand.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,37 @@ operator-sdk test local ./test/e2e --global-manifest deploy/crds/cache.example.c
1616

1717
# we use the test-memcached namespace for all future tests, so we only need to set this trap once
1818
kubectl create namespace test-memcached
19-
trap_add 'kubectl delete namespace test-memcached || true' EXIT
20-
operator-sdk test local ./test/e2e --namespace=test-memcached
19+
trap_add 'kubectl delete --ignore-not-found namespace test-memcached' EXIT
20+
operator-sdk test local ./test/e2e --deploy-namespace=test-memcached
2121
kubectl delete namespace test-memcached
2222

2323
# test operator in up local mode
2424
kubectl create namespace test-memcached
25-
operator-sdk test local ./test/e2e --up-local --namespace=test-memcached
25+
operator-sdk test local ./test/e2e --up-local --deploy-namespace=test-memcached
26+
kubectl delete namespace test-memcached
27+
28+
# test operator in up local mode with --watch-namespace flag
29+
kubectl create namespace test-memcached
30+
operator-sdk test local ./test/e2e --up-local --deploy-namespace=test-memcached --watch-namespace=""
2631
kubectl delete namespace test-memcached
2732

2833
# test operator in up local mode with kubeconfig
2934
kubectl create namespace test-memcached
30-
operator-sdk test local ./test/e2e --up-local --namespace=test-memcached --kubeconfig $KUBECONFIG
35+
operator-sdk test local ./test/e2e --up-local --deploy-namespace=test-memcached --kubeconfig $KUBECONFIG
3136
kubectl delete namespace test-memcached
3237

3338
# test operator in no-setup mode
3439
kubectl create namespace test-memcached
3540
kubectl create -f deploy/crds/cache.example.com_memcacheds_crd.yaml
3641
# this runs after the popd at the end, so it needs the path from the project root
37-
trap_add 'kubectl delete -f test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml' EXIT
42+
trap_add 'kubectl delete --ignore-not-found -f test/test-framework/deploy/crds/cache.example.com_memcacheds_crd.yaml' EXIT
3843
kubectl create -f deploy/crds/cache.example.com_memcachedrs_crd.yaml
3944
# this runs after the popd at the end, so it needs the path from the project root
40-
trap_add 'kubectl delete -f test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml' EXIT
45+
trap_add 'kubectl delete --ignore-not-found -f test/test-framework/deploy/crds/cache.example.com_memcachedrs_crd.yaml' EXIT
4146
kubectl create -f deploy/service_account.yaml --namespace test-memcached
4247
kubectl create -f deploy/role.yaml --namespace test-memcached
4348
kubectl create -f deploy/role_binding.yaml --namespace test-memcached
4449
kubectl create -f deploy/operator.yaml --namespace test-memcached
45-
operator-sdk test local ./test/e2e --namespace=test-memcached --no-setup
50+
operator-sdk test local ./test/e2e --deploy-namespace=test-memcached --no-setup
4651
kubectl delete namespace test-memcached
4752
popd

pkg/test/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (f *Framework) newTestCtx(t *testing.T) *TestCtx {
6666

6767
var namespace string
6868
if f.singleNamespaceMode {
69-
namespace = f.Namespace
69+
namespace = f.DeployNamespace
7070
}
7171
return &TestCtx{
7272
id: id,

pkg/test/e2eutil/wait_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func waitForDeployment(t *testing.T, kubeclient kubernetes.Interface, namespace,
5252
deployment, err := kubeclient.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{})
5353
if err != nil {
5454
if apierrors.IsNotFound(err) {
55-
t.Logf("Waiting for availability of %s deployment\n", name)
55+
t.Logf("Waiting for availability of %s/%s deployment\n", namespace, name)
5656
return false, nil
5757
}
5858
return false, err

pkg/test/framework.go

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ type Framework struct {
6060
KubeClient kubernetes.Interface
6161
Scheme *runtime.Scheme
6262
NamespacedManPath *string
63-
Namespace string
63+
DeployNamespace string
64+
WatchNamespace string
6465
LocalOperator bool
6566

6667
projectRoot string
@@ -74,26 +75,29 @@ type Framework struct {
7475
}
7576

7677
type frameworkOpts struct {
77-
projectRoot string
78-
kubeconfigPath string
79-
globalManPath string
80-
namespacedManPath string
81-
localOperator bool
82-
singleNamespaceMode bool
83-
isLocalOperator bool
84-
localOperatorArgs string
78+
projectRoot string
79+
kubeconfigPath string
80+
globalManPath string
81+
namespacedManPath string
82+
localOperator bool
83+
singleNamespaceMode bool
84+
watchDeployNamespace bool
85+
isLocalOperator bool
86+
localOperatorArgs string
8587
}
8688

8789
const (
88-
ProjRootFlag = "root"
89-
KubeConfigFlag = "kubeconfig"
90-
NamespacedManPathFlag = "namespacedMan"
91-
GlobalManPathFlag = "globalMan"
92-
SingleNamespaceFlag = "singleNamespace"
93-
LocalOperatorFlag = "localOperator"
94-
LocalOperatorArgs = "localOperatorArgs"
95-
96-
TestNamespaceEnv = "TEST_NAMESPACE"
90+
ProjRootFlag = "root"
91+
KubeConfigFlag = "kubeconfig"
92+
NamespacedManPathFlag = "namespacedMan"
93+
GlobalManPathFlag = "globalMan"
94+
SingleNamespaceFlag = "singleNamespace"
95+
WatchDeployNamespaceFlag = "watchDeployNamespace"
96+
LocalOperatorFlag = "localOperator"
97+
LocalOperatorArgs = "localOperatorArgs"
98+
99+
TestDeployNamespaceEnv = "TEST_DEPLOY_NAMESPACE"
100+
TestWatchNamespaceEnv = "TEST_WATCH_NAMESPACE"
97101
)
98102

99103
func (opts *frameworkOpts) addToFlagSet(flagset *flag.FlagSet) {
@@ -103,6 +107,7 @@ func (opts *frameworkOpts) addToFlagSet(flagset *flag.FlagSet) {
103107
flagset.StringVar(&opts.kubeconfigPath, KubeConfigFlag, "", "path to kubeconfig")
104108
flagset.StringVar(&opts.globalManPath, GlobalManPathFlag, "", "path to operator manifest")
105109
flagset.BoolVar(&opts.singleNamespaceMode, SingleNamespaceFlag, false, "enable single namespace mode")
110+
flagset.BoolVar(&opts.watchDeployNamespace, WatchDeployNamespaceFlag, false, "set watch namespace to deploy namespace")
106111
flagset.StringVar(&opts.localOperatorArgs, LocalOperatorArgs, "", "flags that the operator needs (while using --up-local). example: \"--flag1 value1 --flag2=value2\"")
107112
}
108113

@@ -112,14 +117,19 @@ func newFramework(opts *frameworkOpts) (*Framework, error) {
112117
return nil, fmt.Errorf("failed to build the kubeconfig: %v", err)
113118
}
114119

115-
namespace := kcNamespace
120+
deployNamespace := kcNamespace
116121
if opts.singleNamespaceMode {
117-
testNamespace := os.Getenv(TestNamespaceEnv)
118-
if testNamespace != "" {
119-
namespace = testNamespace
122+
testDeployNamespace := os.Getenv(TestDeployNamespaceEnv)
123+
if testDeployNamespace != "" {
124+
deployNamespace = testDeployNamespace
120125
}
121126
}
122127

128+
watchNamespace := os.Getenv(TestWatchNamespaceEnv)
129+
if watchNamespace == "" && opts.watchDeployNamespace {
130+
watchNamespace = deployNamespace
131+
}
132+
123133
kubeclient, err := kubernetes.NewForConfig(kubeconfig)
124134
if err != nil {
125135
return nil, fmt.Errorf("failed to build the kubeclient: %v", err)
@@ -147,7 +157,8 @@ func newFramework(opts *frameworkOpts) (*Framework, error) {
147157
KubeClient: kubeclient,
148158
Scheme: scheme,
149159
NamespacedManPath: &opts.namespacedManPath,
150-
Namespace: namespace,
160+
DeployNamespace: deployNamespace,
161+
WatchNamespace: watchNamespace,
151162
LocalOperator: opts.isLocalOperator,
152163

153164
projectRoot: opts.projectRoot,
@@ -190,7 +201,7 @@ func (f *Framework) addToScheme(addToScheme addToSchemeFunc, obj runtime.Object)
190201
}
191202
err = wait.PollImmediate(time.Second, time.Second*10, func() (done bool, err error) {
192203
if f.singleNamespaceMode {
193-
err = dynClient.List(goctx.TODO(), obj, dynclient.InNamespace(f.Namespace))
204+
err = dynClient.List(goctx.TODO(), obj, dynclient.InNamespace(f.DeployNamespace))
194205
} else {
195206
err = dynClient.List(goctx.TODO(), obj, dynclient.InNamespace("default"))
196207
}
@@ -284,6 +295,6 @@ func (f *Framework) setupLocalCommand() (*exec.Cmd, error) {
284295
// be populated by NewDefaultClientConfigLoadingRules()
285296
localCmd.Env = append(os.Environ(), fmt.Sprintf("%v=%v", k8sutil.KubeConfigEnvVar, clientcmd.NewDefaultClientConfigLoadingRules().Precedence[0]))
286297
}
287-
localCmd.Env = append(localCmd.Env, fmt.Sprintf("%v=%v", k8sutil.WatchNamespaceEnvVar, f.Namespace))
298+
localCmd.Env = append(localCmd.Env, fmt.Sprintf("%v=%v", k8sutil.WatchNamespaceEnvVar, f.WatchNamespace))
288299
return localCmd, nil
289300
}

test/ansible-memcached/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ provisioner:
2929
inventory:
3030
group_vars:
3131
all:
32-
namespace: ${TEST_NAMESPACE:-osdk-test}
32+
namespace: ${TEST_DEPLOY_NAMESPACE:-osdk-test}
3333
env:
3434
K8S_AUTH_KUBECONFIG: /tmp/molecule/kind-test-local/kubeconfig
3535
KUBECONFIG: /tmp/molecule/kind-test-local/kubeconfig

test/e2e/_incluster-test-code/memcached_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func MemcachedLocal(t *testing.T) {
217217
if err != nil {
218218
t.Fatal(err)
219219
}
220-
cmd := exec.Command("operator-sdk", "up", "local", "--namespace="+namespace)
220+
cmd := exec.Command("operator-sdk", "up", "local", "--watch-namespace="+namespace)
221221
stderr, err := os.Create("stderr.txt")
222222
if err != nil {
223223
t.Fatalf("Failed to create stderr.txt: %v", err)

0 commit comments

Comments
 (0)