Skip to content

Commit

Permalink
makefile: use build tags for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD committed Apr 16, 2024
1 parent a52c75a commit faa9e43
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,37 @@ test: test-unit

test-integ: ## Run integration tests
@printf "\033[2m→ Running integration tests...\033[0m\n"
$(eval testintegtags += "integration")
$(eval testintegpath = "./...")
$(eval testintegtags += "integration,base,plugin")
ifdef multinode
$(eval testintegtags += "multinode")
endif
ifdef race
$(eval testintegargs += "-race")
endif
ifdef unreleased
$(eval testintegpath = "./opensearchapi/...")
endif
$(eval testintegargs += "-cover" "-tags=$(testintegtags)" "-timeout=1h" "$(testintegpath)" "-args" "-test.gocoverdir=$(PWD)/tmp/integration")
$(eval testintegargs += "-cover" "-tags=$(testintegtags)" "-timeout=1h" "./..." "-args" "-test.gocoverdir=$(PWD)/tmp/integration")
@mkdir -p $(PWD)/tmp/integration
@echo "go test -v" $(testintegargs); \
go test -v $(testintegargs);
ifdef coverage
@go tool covdata textfmt -i=$(PWD)/tmp/integration -o $(PWD)/tmp/integ.cov
endif

test-integ-base: ## Run base integration tests
@make test-integ testintegtags=integration,base

test-integ-plugin: ## Run plugin integration tests
@make test-integ testintegtags=integration,plugin

test-integ-secure: ##Run secure integration tests
@SECURE_INTEGRATION=true make test-integ

test-integ-base-secure: ## Run secure base integration tests
@SECURE_INTEGRATION=true make test-integ testintegtags=integration,base

test-integ-plugin-secure: ## Run secure plugin integration tests
@SECURE_INTEGRATION=true make test-integ testintegtags=integration,plugin


test-bench: ## Run benchmarks
@printf "\033[2m→ Running benchmarks...\033[0m\n"
go test -run=none -bench=. -benchmem ./...
Expand Down

0 comments on commit faa9e43

Please sign in to comment.