Skip to content

Commit 660e1e4

Browse files
authored
Merge pull request kubernetes#94789 from zhouya0/cleanup_ns_flag
Clean up remaining ns flag
2 parents 3eb90c1 + 438ec9b commit 660e1e4

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

test/e2e/kubectl/kubectl.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,24 @@ properties:
170170
// Aware of the kubectl example files map.
171171
func cleanupKubectlInputs(fileContents string, ns string, selectors ...string) {
172172
ginkgo.By("using delete to clean up resources")
173-
var nsArg string
174-
if ns != "" {
175-
nsArg = fmt.Sprintf("--namespace=%s", ns)
176-
}
177173
// support backward compatibility : file paths or raw json - since we are removing file path
178174
// dependencies from this test.
179-
framework.RunKubectlOrDieInput(ns, fileContents, "delete", "--grace-period=0", "--force", "-f", "-", nsArg)
175+
framework.RunKubectlOrDieInput(ns, fileContents, "delete", "--grace-period=0", "--force", "-f", "-")
180176
assertCleanup(ns, selectors...)
181177
}
182178

183179
// assertCleanup asserts that cleanup of a namespace wrt selectors occurred.
184180
func assertCleanup(ns string, selectors ...string) {
185-
var nsArg string
186-
if ns != "" {
187-
nsArg = fmt.Sprintf("--namespace=%s", ns)
188-
}
189-
190181
var e error
191182
verifyCleanupFunc := func() (bool, error) {
192183
e = nil
193184
for _, selector := range selectors {
194-
resources := framework.RunKubectlOrDie(ns, "get", "rc,svc", "-l", selector, "--no-headers", nsArg)
185+
resources := framework.RunKubectlOrDie(ns, "get", "rc,svc", "-l", selector, "--no-headers")
195186
if resources != "" {
196187
e = fmt.Errorf("Resources left running after stop:\n%s", resources)
197188
return false, nil
198189
}
199-
pods := framework.RunKubectlOrDie(ns, "get", "pods", "-l", selector, nsArg, "-o", "go-template={{ range .items }}{{ if not .metadata.deletionTimestamp }}{{ .metadata.name }}{{ \"\\n\" }}{{ end }}{{ end }}")
190+
pods := framework.RunKubectlOrDie(ns, "get", "pods", "-l", selector, "-o", "go-template={{ range .items }}{{ if not .metadata.deletionTimestamp }}{{ .metadata.name }}{{ \"\\n\" }}{{ end }}{{ end }}")
200191
if pods != "" {
201192
e = fmt.Errorf("Pods left unterminated after stop:\n%s", pods)
202193
return false, nil

0 commit comments

Comments
 (0)