Skip to content

Commit

Permalink
test/e2e: NamespacedTest helper can create/delete multiple namespaces (
Browse files Browse the repository at this point in the history
…#5928)


Signed-off-by: satyazzz123 <[email protected]>
  • Loading branch information
satyazzz123 authored Nov 2, 2023
1 parent ac77b71 commit f661786
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,17 @@ type NamespacedGatewayTestBody func(ns string, gw types.NamespacedName)
type NamespacedTestBody func(string)
type TestBody func()

func (f *Framework) NamespacedTest(namespace string, body NamespacedTestBody) {
func (f *Framework) NamespacedTest(namespace string, body NamespacedTestBody, additionalNamespaces ...string) {
ginkgo.Context("with namespace: "+namespace, func() {
ginkgo.BeforeEach(func() {
f.CreateNamespace(namespace)
for _, ns := range append(additionalNamespaces, namespace) {
f.CreateNamespace(ns)
}
})
ginkgo.AfterEach(func() {
f.DeleteNamespace(namespace, false)
for _, ns := range append(additionalNamespaces, namespace) {
f.DeleteNamespace(ns, false)
}
})

body(namespace)
Expand Down

0 comments on commit f661786

Please sign in to comment.