Skip to content

Commit 65e4dd7

Browse files
cleanup e2e tests for go/v4
1 parent 6d8b808 commit 65e4dd7

File tree

2 files changed

+157
-140
lines changed

2 files changed

+157
-140
lines changed

test/e2e/utils/test_context.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,21 @@ func (t *TestContext) CreateManagerNamespace() error {
270270
return err
271271
}
272272

273-
// LabelAllNamespacesToWarnAboutRestricted will label all namespaces so that we can verify
273+
// LabelNamespacesToWarnAboutRestricted will label all namespaces so that we can verify
274274
// if a warning with `Warning: would violate PodSecurity` will be raised when the manifests are applied
275-
func (t *TestContext) LabelAllNamespacesToWarnAboutRestricted() error {
276-
_, err := t.Kubectl.Command("label", "--overwrite", "ns", "--all",
275+
func (t *TestContext) LabelNamespacesToWarnAboutRestricted() error {
276+
_, err := t.Kubectl.Command("label", "--overwrite", "ns", t.Kubectl.Namespace,
277277
"pod-security.kubernetes.io/warn=restricted")
278278
return err
279279
}
280280

281+
// RemoveNamespaceLabelToWarnAboutRestricted will remove the `pod-security.kubernetes.io/warn` label
282+
// from the specified namespace
283+
func (t *TestContext) RemoveNamespaceLabelToWarnAboutRestricted() error {
284+
_, err := t.Kubectl.Command("label", "ns", t.Kubectl.Namespace, "pod-security.kubernetes.io/warn-")
285+
return err
286+
}
287+
281288
// LoadImageToKindCluster loads a local docker image to the kind cluster
282289
func (t *TestContext) LoadImageToKindCluster() error {
283290
cluster := "kind"

0 commit comments

Comments
 (0)