build: correct Makefile to run smoke tests locally (#16137)

This commit is contained in:
Farbod Ahmadian 2023-02-16 19:28:39 +03:30 committed by GitHub
parent fbc51dd190
commit 6e9ee969ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -32,6 +32,11 @@ ifndef NOMAD_NO_UI
GO_TAGS := ui $(GO_TAGS)
endif
#GOTEST_GROUP is set in CI pipelines. We have to set it for local run.
ifndef GOTEST_GROUP
GOTEST_GROUP := nomad client command drivers quick
endif
# tag corresponding to latest release we maintain backward compatibility with
PROTO_COMPARE_TAG ?= v1.0.3$(if $(findstring ent,$(GO_TAGS)),+ent,)
@ -408,3 +413,15 @@ ec2info: ## Generate AWS EC2 CPU specification table
.PHONY: cl
cl: ## Create a new Changelog entry
@go run -modfile tools/go.mod tools/cl-entry/main.go
.PHONY: test
test: GOTEST_PKGS := $(foreach g,$(GOTEST_GROUP),$(shell go run -modfile=tools/go.mod tools/missing/main.go ci/test-core.json $(g)))
test: ## Use this target as a smoke test
@echo "==> Running Nomad smoke tests on groups: $(GOTEST_GROUP)"
@echo "==> with packages: $(GOTEST_PKGS)"
gotestsum --format=testname --packages="$(GOTEST_PKGS)" -- \
-cover \
-timeout=20m \
-count=1 \
-tags "$(GO_TAGS)" \
$(GOTEST_PKGS)

View File

@ -44,10 +44,14 @@ Developing without Vagrant
```sh
$ [ "$(ulimit -n)" -lt 1024 ] && ulimit -n 1024
```
1. Verify you can run tests
1. Verify you can run smoke tests
```sh
$ make test
```
**Note:** You can think of this as a `smoke` test which runs a subset of
tests and some may fail because of `operation not permitted` error which
requires `root` access. You can use `go test` to test the specific subsystem
which you are working on and let the CI run rest of the tests for you.
Running a development build
---