Skip to content

Commit ea859a2

Browse files
committed
🌱 Remove ginkgo from e2e tests
Signed-off-by: Todd Short <[email protected]>
1 parent d02bca5 commit ea859a2

File tree

5 files changed

+402
-394
lines changed

5 files changed

+402
-394
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ test: manifests generate fmt vet test-unit test-e2e #HELP Run all tests.
105105
.PHONY: e2e
106106
FOCUS := $(if $(TEST),-v -focus "$(TEST)")
107107
E2E_FLAGS ?= ""
108-
e2e: $(GINKGO) #EXHELP Run the e2e tests.
109-
$(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/e2e
108+
e2e: $(SETUP_ENVTEST) #EXHELP Run the e2e tests.
109+
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -v $(shell go list ./test/e2e)
110110

111111
export REG_PKG_NAME=registry-operator
112112
export PLAIN_PKG_NAME=plain-operator
113113
export CATALOG_IMG=${E2E_REGISTRY_NAME}.${E2E_REGISTRY_NAMESPACE}.svc:5000/test-catalog:e2e
114114
.PHONY: test-op-dev-e2e
115-
test-op-dev-e2e: $(GINKGO) $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run operator create, upgrade and delete tests.
115+
test-op-dev-e2e: $(SETUP_ENVTEST) $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run operator create, upgrade and delete tests.
116116
test/operator-framework-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) ${E2E_REGISTRY_NAMESPACE}
117-
$(GINKGO) --tags $(GO_BUILD_TAGS) -trace -progress $(FOCUS) test/operator-framework-e2e
117+
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -v $(shell go list ./test/operator-framework-e2e)
118118

119119
.PHONY: test-unit
120120
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')

test/e2e/e2e_suite_test.go

+11-31
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ package e2e
22

33
import (
44
"context"
5+
"os"
56
"testing"
6-
"time"
77

8-
. "github.com/onsi/ginkgo/v2"
9-
. "github.com/onsi/gomega"
108
appsv1 "k8s.io/api/apps/v1"
119
corev1 "k8s.io/api/core/v1"
12-
"k8s.io/utils/env"
1310

1411
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1512
"k8s.io/apimachinery/pkg/runtime"
13+
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
1614
"k8s.io/client-go/rest"
1715
ctrl "sigs.k8s.io/controller-runtime"
1816
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -33,41 +31,23 @@ const (
3331
testCatalogName = "test-catalog"
3432
)
3533

36-
func TestE2E(t *testing.T) {
37-
RegisterFailHandler(Fail)
38-
SetDefaultEventuallyTimeout(1 * time.Minute)
39-
SetDefaultEventuallyPollingInterval(1 * time.Second)
40-
RunSpecs(t, "E2E Suite")
41-
}
42-
43-
var _ = BeforeSuite(func() {
34+
func TestMain(m *testing.M) {
4435
cfg = ctrl.GetConfigOrDie()
4536

4637
scheme := runtime.NewScheme()
4738

48-
Expect(operatorv1alpha1.AddToScheme(scheme)).To(Succeed())
49-
Expect(rukpakv1alpha1.AddToScheme(scheme)).To(Succeed())
50-
Expect(catalogd.AddToScheme(scheme)).To(Succeed())
39+
utilruntime.Must(operatorv1alpha1.AddToScheme(scheme))
40+
utilruntime.Must(rukpakv1alpha1.AddToScheme(scheme))
41+
utilruntime.Must(catalogd.AddToScheme(scheme))
42+
utilruntime.Must(appsv1.AddToScheme(scheme))
43+
utilruntime.Must(corev1.AddToScheme(scheme))
5144

5245
var err error
53-
54-
err = appsv1.AddToScheme(scheme)
55-
Expect(err).ToNot(HaveOccurred())
56-
57-
err = corev1.AddToScheme(scheme)
58-
Expect(err).ToNot(HaveOccurred())
59-
6046
c, err = client.New(cfg, client.Options{Scheme: scheme})
61-
Expect(err).To(Not(HaveOccurred()))
62-
})
47+
utilruntime.Must(err)
6348

64-
var _ = AfterSuite(func() {
65-
ctx := context.Background()
66-
if basePath := env.GetString("ARTIFACT_PATH", ""); basePath != "" {
67-
// get all the artifacts from the test run and save them to the artifact path
68-
getArtifactsOutput(ctx, basePath)
69-
}
70-
})
49+
os.Exit(m.Run())
50+
}
7151

7252
// createTestCatalog will create a new catalog on the test cluster, provided
7353
// the context, catalog name, and the image reference. It returns the created catalog

0 commit comments

Comments
 (0)