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

Delete the hosting test namespace before the hosted test namespace #251

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@
"KUBECONFIG": "${workspaceFolder}/kubeconfig_managed",
}
},
// Run `make kind-bootstrap-cluster-dev` and `make kind-additional-cluster` before launching this.
{
"name": "Launch Package (Hosted Mode)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"args": [
"controller",
"--leader-elect=false",
"--log-level=3",
"--v=5",
"--enable-operator-policy=true",
"--target-kubeconfig-path=${workspaceFolder}/kubeconfig_managed2",
],
"env": {
"WATCH_NAMESPACE": "managed",
"KUBECONFIG": "${workspaceFolder}/kubeconfig_managed",
}
},
// Set FDescribe or FIt on the test to debug. Then set the desired breakpoint.
{
"name": "Launch Test Function (instructions in launch.json)",
Expand Down
13 changes: 8 additions & 5 deletions test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ var _ = Describe("Testing OperatorPolicy", Ordered, Label("supports-hosted"), fu
}

preFunc := func() {
utils.Kubectl("create", "ns", opPolTestNS)

if IsHosted {
KubectlTarget("create", "ns", opPolTestNS)
DeferCleanup(func() {
KubectlTarget("delete", "ns", opPolTestNS)
})
}
utils.Kubectl("create", "ns", opPolTestNS)

DeferCleanup(func() {
utils.Kubectl("delete", "ns", opPolTestNS)
utils.Kubectl("delete", "ns", opPolTestNS, "--ignore-not-found")

if IsHosted {
KubectlTarget("delete", "ns", opPolTestNS, "--ignore-not-found")
}
})
}

Expand Down