Skip to content

Commit

Permalink
Merge pull request #169 from adambkaplan/skip-ginkgo
Browse files Browse the repository at this point in the history
Skip EnvTest Tests
  • Loading branch information
openshift-ci[bot] authored Nov 2, 2023
2 parents 260b7c1 + 6dd9290 commit f159843
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ verify-fmt: fmt ## Verify formatting and ensure git status is clean
vet: ## Run go vet against code.
go vet ./...

SKIP_ENVTEST ?= false

BINDATA = $(shell pwd)/kodata
.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KO_DATA_PATH=${BINDATA} KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out -p 1 -failfast -test.v -test.failfast
test: manifests generate fmt vet envtest ## Run tests. To bypass longer-running reconcile tests with EnvTest, set SKIP_ENVTEST=true.
KO_DATA_PATH=${BINDATA} KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" SKIP_ENVTEST=${SKIP_ENVTEST} go test ./... -coverprofile cover.out -failfast -test.v -test.failfast

##@ Build

Expand Down
7 changes: 7 additions & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ package controllers

import (
"context"
"os"
"path/filepath"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -41,6 +43,11 @@ var (
)

func TestAPIs(t *testing.T) {
skip := os.Getenv("SKIP_ENVTEST")
shouldSkip, _ := strconv.ParseBool(skip)
if shouldSkip {
t.Skip("bypassing Ginkgo-driven tests")
}
RegisterFailHandler(Fail)
SetDefaultEventuallyTimeout(restTimeout)
SetDefaultEventuallyPollingInterval(restRetry)
Expand Down

0 comments on commit f159843

Please sign in to comment.