tests: run unit tests outside of docker by default

This allows execution of unit tests within the devcontainer environment, which already has the correct golang.
This commit is contained in:
Jose Diaz-Gonzalez
2024-12-03 21:45:41 -05:00
parent 2321f016d9
commit f20a6a2563
2 changed files with 6 additions and 4 deletions

View File

@@ -179,14 +179,16 @@ go-tests:
@$(MAKE) go-test-plugin PLUGIN_NAME=network
go-test-plugin:
cd plugins/$(PLUGIN_NAME) && go get github.com/onsi/gomega && DOKKU_ROOT=/home/dokku go test -v -p 1 -race -mod=readonly || exit $$?
go-test-plugin-in-docker:
@echo running go unit tests...
docker run --rm \
-e DOKKU_ROOT=/home/dokku \
-e GO111MODULE=on \
-v $$PWD:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT) \
$(BUILD_IMAGE) \
bash -c "cd plugins/$(PLUGIN_NAME) && go get github.com/onsi/gomega && go test -v -p 1 -race -mod=readonly " || exit $$?
bash -c "make go-test-plugin PLUGIN_NAME=$(PLUGIN_NAME)" || exit $$?
unit-tests: go-tests
@echo running bats unit tests...