Skip to content

Commit

Permalink
Ginkgo v2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
razo7 committed Jan 2, 2023
1 parent 3167458 commit d8ed845
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ test: test-no-verify verify-unchanged ## Generate and format code, run tests, ge

.PHONY: test-no-verify
test-no-verify: manifests generate go-verify fmt vet envtest ginkgo ## Generate and format code, and run tests
ACK_GINKGO_DEPRECATIONS=$(GINKGO_VERSION) KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(LOCALBIN))" $(GINKGO) -v -r --keepGoing -requireSuite ./api/... ./controllers/... -coverprofile cover.out
ACK_GINKGO_DEPRECATIONS=$(GINKGO_VERSION) KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(LOCALBIN))" $(GINKGO) -v -r --keep-going -require-suite ./api/... ./controllers/... -coverprofile cover.out

##@ Build

Expand Down
8 changes: 2 additions & 6 deletions api/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)
Expand All @@ -54,10 +53,7 @@ var cancel context.CancelFunc

func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Webhook Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Webhook Suite")
}

var _ = BeforeSuite(func() {
Expand Down Expand Up @@ -136,7 +132,7 @@ var _ = BeforeSuite(func() {
return nil
}).Should(Succeed())

}, 60)
})

var _ = AfterSuite(func() {
cancel()
Expand Down
8 changes: 2 additions & 6 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

Expand All @@ -47,18 +46,15 @@ var ctxFromSignalHandler context.Context

func TestControllers(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

// call start or refactor when moving to "normal" testEnv test

}, 60)
})

func startTestEnv() {
By("bootstrapping test environment")
Expand Down
6 changes: 3 additions & 3 deletions hack/functest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ fi

# -v: print out the text and location for each spec before running it and flush output to stdout in realtime
# -r: run suites recursively
# --keepGoing: don't stop on failing suite
# -requireSuite: fail if tests are not executed because of missing suite
ACK_GINKGO_DEPRECATIONS=$1 ./bin/ginkgo/$1/ginkgo $NO_COLOR -v -r --keepGoing -requireSuite ./test/e2e
# --keep-going: don't stop on failing suite
# -require-suite: fail if tests are not executed because of missing suite
ACK_GINKGO_DEPRECATIONS=$1 ./bin/ginkgo/$1/ginkgo $NO_COLOR -v -r --keep-going -require-suite ./test/e2e

if [[ $? != 0 ]]; then
echo "E2e tests FAILED"
Expand Down

0 comments on commit d8ed845

Please sign in to comment.