diff --git a/workhorse/.gitignore b/workhorse/.gitignore index 7d339fef482a803fd48dca4afab0c0ed74898042..97a27630a9c6d7589e8301fbf214b9c42ef43cca 100644 --- a/workhorse/.gitignore +++ b/workhorse/.gitignore @@ -9,3 +9,4 @@ testdata/alt-public /_build coverage.html /*.toml +/gitaly.pid diff --git a/workhorse/Makefile b/workhorse/Makefile index 3cf592b0cffa22ee1ca2bfc72a5bcba5d0615b75..890d460adbcd084846973c7a628591a3c639078c 100644 --- a/workhorse/Makefile +++ b/workhorse/Makefile @@ -65,7 +65,12 @@ install: $(EXE_ALL) .PHONY: test test: prepare-tests $(call message,$@) - go test -tags "$(BUILD_TAGS)" ./... ;\ + @if [ -z "$${GITALY_ADDRESS+x}" ] ; then \ + echo "To run gitaly integration tests set GITALY_ADDRESS=tcp://127.0.0.1:8075" ; \ + else \ + $(MAKE) run-gitaly ; \ + fi + @go test -tags "$(BUILD_TAGS)" ./... ;\ status="$$?" ;\ if [ -f "$(GITALY_PID_FILE)" ] ; then \ echo "Clean up Gitaly server for workhorse integration test" ;\ @@ -93,27 +98,24 @@ clean-build: rm -rf $(TARGET_DIR) .PHONY: prepare-tests -prepare-tests: run-gitaly prepare-tests: testdata/data/group/test.git $(EXE_ALL) prepare-tests: testdata/scratch .PHONY: run-gitaly -run-gitaly: gitaly.pid +run-gitaly: $(GITALY_PID_FILE) $(GITALY_PID_FILE): gitaly.toml - @{ \ - if [ -z "$${GITALY_ADDRESS+x}" ] ; then \ - echo "To run gitaly integration tests set GITALY_ADDRESS=tcp://127.0.0.1:8075" ; \ - else \ - cd .. ; \ - GITALY_TESTING_NO_GIT_HOOKS=1 GITALY_PID_FILE=workhorse/$(GITALY_PID_FILE) $(GITALY) workhorse/gitaly.toml ; \ - fi \ - } & + $(call message, "Starting gitaly") + cd ..; GITALY_TESTING_NO_GIT_HOOKS=1 GITALY_PID_FILE=workhorse/$(GITALY_PID_FILE) $(GITALY) workhorse/gitaly.toml & gitaly.toml: ../tmp/tests/gitaly/config.toml sed -e 's/^socket_path.*$$/listen_addr = "0.0.0.0:8075"/;s/^\[auth\]$$//;s/^token.*$$//;s/^internal_socket_dir.*$$//' \ $< > $@ +../tmp/tests/gitaly/config.toml: + $(call message, "Building a complete test environment") + cd .. ; ./scripts/setup-test-env + testdata/data/group/test.git: $(call message,$@) git clone --quiet --bare https://gitlab.com/gitlab-org/gitlab-test.git $@