Skip to content

Commit

Permalink
Fix make test to unbreak make clean
Browse files Browse the repository at this point in the history
`make test` is known to be failing since a long time. An issue is that
it thus leaks a directory that prevents `make clean` to succeed because
of restrictive file access modes.

Separate the building of the test, which introduces the file access mode
issue, from the actual test run. This allows to fully benefit from the
access mode fixing introduced by PR #240.

Signed-off-by: Greg Kurz <[email protected]>
  • Loading branch information
gkurz committed Jul 15, 2024
1 parent 35413b1 commit c35ed6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ test: manifests generate fmt vet envtest ## Run tests.
ifneq (, $(SKIP_TESTS))
@echo Skipping tests. Unset SKIP_TESTS to actually run them.
else
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GOFLAGS) ./... -coverprofile cover.out
# set write flag on created folder, so that we can clean it up
# Just build the test and set write flag on created folder, so that we can clean it up
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GOFLAGS) ./... -coverprofile cover.out -c
chmod +w $(LOCALBIN)/k8s/$(ENVTEST_K8S_VERSION)*
# Then run the test
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GOFLAGS) ./... -coverprofile cover.out
endif

##@ Build
Expand Down

0 comments on commit c35ed6d

Please sign in to comment.