Skip to content

Commit 7c8b175

Browse files
committed
tests: Set GIT_CONFIG_GLOBAL=/dev/null for tests run via make test
This ensures that no host specific git configuration is pulled in while testing. One such example would be "init.defaultBranch" which is set to "main" on some hosts, which then causes tests to fail as they keep looking for "master" branches. Signed-off-by: Alexander Block <[email protected]>
1 parent cfbe6ac commit 7c8b175

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ build: check-deps $(LIBGIT2) ## Build manager binary
9696
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
9797
test: $(LIBGIT2) install-envtest test-api check-deps ## Run tests
9898
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
99+
GIT_CONFIG_GLOBAL=/dev/null \
99100
go test $(GO_STATIC_FLAGS) ./... -coverprofile cover.out
100101

101102
check-deps:
@@ -268,3 +269,4 @@ env: $(LIBGIT2)
268269
echo 'CGO_CFLAGS="$(CGO_CFLAGS)"' >> $(BUILD_DIR)/.env
269270
echo 'CGO_LDFLAGS="$(CGO_LDFLAGS)"' >> $(BUILD_DIR)/.env
270271
echo 'KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS)' >> $(BUILD_DIR)/.env
272+
echo 'GIT_CONFIG_GLOBAL=/dev/null' >> $(BUILD_DIR)/.env

0 commit comments

Comments
 (0)