@@ -139,23 +139,37 @@ ifneq (,$(wildcard ./builtunitetest.test))
139
139
$(GOTESTSUM) --raw-command -- $(GOCMD) tool test2json -p "./..." -t ./builtunitetest.test -test.v -test.failfast -test.timeout $(GOTEST_TIMEOUT)
140
140
endif
141
141
142
+ INTEGRATION_TEST_FILES := $(shell find . -name *integration_test.go)
143
+ INTEGRATION_TESTS := $(shell cat $(INTEGRATION_TEST_FILES) | sed -n "s/func \(Test[A-Za-z0-9_]*\).*/\1/p" | xargs | sed "s/ /|/g")
142
144
.PHONY: mod-integration-test
143
145
mod-integration-test: $(GOTESTSUM)
144
- @echo "running $(GOCMD) integration test ./... in `pwd`"
145
- $(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- $(GOTEST_OPT_WITH_INTEGRATION)
146
+ @echo "running $(GOCMD) integration test $(INTEGRATION_TESTS) in `pwd`"
147
+ @if [ -n "$(INTEGRATION_TESTS)" ]; then \
148
+ $(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- -run "$(INTEGRATION_TESTS)" $(GOTEST_OPT_WITH_INTEGRATION); \
149
+ else \
150
+ echo "No integration tests in `pwd`"; \
151
+ fi
146
152
@if [ -e integration-coverage.txt ]; then \
147
153
$(GOCMD) tool cover -html=integration-coverage.txt -o integration-coverage.html; \
148
154
fi
149
155
150
156
.PHONY: mod-integration-sudo-test
151
157
mod-integration-sudo-test: $(GOTESTSUM)
152
- @echo "running $(GOCMD) integration sudo (root/privileged) test ./... in `pwd`"
153
- $(GOTESTSUM) $(GOTESTSUM_OPT) --format standard-verbose --packages="./..." -- $(GOTEST_OPT_WITH_INTEGRATION_SUDO)
158
+ @echo "running $(GOCMD) integration sudo (root/privileged) test $(INTEGRATION_TESTS) in `pwd`"
159
+ @if [ -n "$(INTEGRATION_TESTS)" ]; then \
160
+ $(GOTESTSUM) $(GOTESTSUM_OPT) --format standard-verbose --packages="./..." -- -run "$(INTEGRATION_TESTS)" $(GOTEST_OPT_WITH_INTEGRATION_SUDO); \
161
+ else \
162
+ echo "No integration tests in `pwd`"; \
163
+ fi
154
164
155
165
.PHONY: do-integration-tests-with-cover
156
166
do-integration-tests-with-cover: $(GOTESTSUM)
157
- @echo "running $(GOCMD) integration test ./... + coverage in `pwd`"
158
- $(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- $(GOTEST_OPT_WITH_INTEGRATION_COVERAGE)
167
+ @echo "running $(GOCMD) integration test $(INTEGRATION_TESTS) + coverage in `pwd`"
168
+ @if [ -n "$(INTEGRATION_TESTS)" ]; then \
169
+ $(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- -run "$(INTEGRATION_TESTS)" $(GOTEST_OPT_WITH_INTEGRATION_COVERAGE); \
170
+ else \
171
+ echo "No integration tests in `pwd`"; \
172
+ fi
159
173
@if [ -e integration-coverage.txt ]; then \
160
174
$(GOCMD) tool cover -html=integration-coverage.txt -o integration-coverage.html; \
161
175
fi
0 commit comments