Skip to content

Commit

Permalink
Improve cleanPolicy helper func
Browse files Browse the repository at this point in the history
Now it targets the correct namespace, and puts some extra info into the
ginkgo writer, which will be printed if the spec fails.

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
  • Loading branch information
JustinKuli authored and openshift-merge-robot committed Jan 23, 2023
1 parent c52be81 commit 7fd114d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions test/configuration_policy_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ func ConfigPruneBehavior(labels ...string) bool {

cleanPolicy := func(policyName, policyYaml string) func() {
return func() {
_, err := OcHub(
"delete", "-f", policyYaml,
"--ignore-not-found",
)
By("Cleaning up policy " + policyName + ", ignoring if not found")

outHub, err := OcHub("delete", "-f", policyYaml, "-n", UserNamespace, "--ignore-not-found")
GinkgoWriter.Printf("cleanPolicy OcHub output: %v\n", outHub)
Expect(err).To(BeNil())
_, err = OcManaged(
"delete",
"events",
"-n",
ClusterNamespace,
"--field-selector=involvedObject.name="+
UserNamespace+"."+policyName,

outManaged, err := OcManaged(
"delete", "events", "-n", ClusterNamespace,
"--field-selector=involvedObject.name="+UserNamespace+"."+policyName,
"--ignore-not-found",
)
GinkgoWriter.Printf("cleanPolicy OcManaged output: %v\n", outManaged)
Expect(err).To(BeNil())
}
}
Expand Down

0 comments on commit 7fd114d

Please sign in to comment.