Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enable api and manifests regeneration before testing #1007

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ setup-envtest: $(SETUP_ENVTEST) ## Install envtest binaries
clean-envtest: setup-envtest ;## Clean up assets installed by setup-envtest
$Q $(SETUP_ENVTEST) cleanup

check test tests: setup-envtest ; $(info running $(NAME:%=% )tests...) @ ## Run tests
check test tests: tidy generate fmt vet manifests setup-envtest ; $(info running $(NAME:%=% )tests...) @ ## Run tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to run these on make test? Won't it make running tests locally longer?
Maybe we should have build check that tidy/fmt/vet/generate are passing without any file changes, in the same manner as we have for manifests?
Here is the check for manifests: https://github.com/Mellanox/network-operator/blob/master/.github/workflows/build.yml#L52

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time wise this is trivial compared to envtest setup and actual tests. My idea is to make sure that locally running test gives me the best possible confidence.

KUBEBUILDER_ASSETS=`$(SETUP_ENVTEST) use --use-env -p path $(ENVTEST_K8S_VERSION)` $(GO) test -timeout $(TIMEOUT)s $(ARGS) $(TESTPKGS)

COVERAGE_MODE = count
.PHONY: test-coverage

test-coverage: COVERAGE_DIR := $(CURDIR)/test
test-coverage: setup-envtest; $(info running coverage tests...) @ ## Run coverage tests
test-coverage: tidy generate fmt vet manifests setup-envtest; $(info running coverage tests...) @ ## Run coverage tests
KUBEBUILDER_ASSETS=`$(SETUP_ENVTEST) use --use-env -p path $(ENVTEST_K8S_VERSION)` $(GO) test -covermode=$(COVERAGE_MODE) -coverpkg=./... -coverprofile=network-operator.cover $(TESTPKGS)

.PHONY: generate-mocks
Expand Down Expand Up @@ -351,6 +351,18 @@ chart-push: $(HELM) ; $(info Pushing Helm image...) @ ## Push Helm Chart

# Misc

# Run go mod tidy
tidy:
rm -f go.sum; go mod tidy -compat=1.21

# Run go fmt against code
fmt:
go fmt ./...

# Run go vet against code
vet:
go vet ./...

.PHONY: clean
clean: ; $(info Cleaning...) @ ## Cleanup everything
@rm -rf $(BUILDDIR)
Expand Down
Loading