2022-06-09 15:58:07 +02:00
|
|
|
package framework
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/kyverno/kyverno/test/e2e/framework/client"
|
|
|
|
"github.com/kyverno/kyverno/test/e2e/framework/step"
|
|
|
|
"github.com/onsi/ginkgo"
|
|
|
|
"github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Setup(t *testing.T) {
|
2022-08-24 15:08:24 +02:00
|
|
|
t.Helper()
|
2022-06-09 15:58:07 +02:00
|
|
|
gomega.RegisterTestingT(t)
|
|
|
|
if os.Getenv("E2E") == "" {
|
|
|
|
t.Skip("Skipping E2E Test")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-30 21:36:28 +02:00
|
|
|
func RunTest(t *testing.T, steps ...step.Step) {
|
2022-08-24 15:08:24 +02:00
|
|
|
t.Helper()
|
2022-06-09 15:58:07 +02:00
|
|
|
ginkgo.By("Creating client ...")
|
|
|
|
client := client.New(t)
|
|
|
|
for _, step := range steps {
|
|
|
|
step(client)
|
|
|
|
}
|
|
|
|
ginkgo.By("Cleaning up ...")
|
|
|
|
}
|
2022-06-30 21:36:28 +02:00
|
|
|
|
|
|
|
func RunSubTest(t *testing.T, name string, steps ...step.Step) {
|
2022-08-24 15:08:24 +02:00
|
|
|
t.Helper()
|
2022-06-30 21:36:28 +02:00
|
|
|
t.Run(name, func(t *testing.T) {
|
|
|
|
RunTest(t, steps...)
|
|
|
|
})
|
|
|
|
}
|