Skip to content

Commit

Permalink
cleanup e2e tests for go/v4
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamacedo86 committed May 27, 2024
1 parent 6d8b808 commit 65e4dd7
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 140 deletions.
13 changes: 10 additions & 3 deletions test/e2e/utils/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,21 @@ func (t *TestContext) CreateManagerNamespace() error {
return err
}

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

// RemoveNamespaceLabelToWarnAboutRestricted will remove the `pod-security.kubernetes.io/warn` label
// from the specified namespace
func (t *TestContext) RemoveNamespaceLabelToWarnAboutRestricted() error {
_, err := t.Kubectl.Command("label", "ns", t.Kubectl.Namespace, "pod-security.kubernetes.io/warn-")
return err
}

// LoadImageToKindCluster loads a local docker image to the kind cluster
func (t *TestContext) LoadImageToKindCluster() error {
cluster := "kind"
Expand Down
Loading

0 comments on commit 65e4dd7

Please sign in to comment.