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 openshift#240.

Signed-off-by: Greg Kurz <[email protected]>
  • Loading branch information
gkurz authored and beraldoleal committed Aug 7, 2024
1 parent 4a8e33e commit f66efc6
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 f66efc6

Please sign in to comment.