I just ran into a super weird issue and I really don't get what's currently happening..
I had a project while some e2e tests, everything was working fine. For some reason, I had to use some privates repositories (from gitlab) of mine as I developed some layers related to databases and others purposes.
The thing is, when I tried to run go test
from docker compose command, it's now failing with the following message:
e2e_tests_1 | FAIL gitlab.com/foo-bar-group/awesome-api/tests/e2e [setup failed]
e2e_tests_1 | # gitlab.com/foo-bar-group/awesome-api/tests/e2e
e2e_tests_1 | internal/domain/models/file_infos.go:7:2: gitlab.com/emixam23-generic-utils/google-cloud-storage@vxxx: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/xxx: exit status 128:
e2e_tests_1 | fatal: could not read Username for 'https://gitlab.com': terminal prompts disabled
e2e_tests_1 | FAIL
I have a simple docker compose that runs 3 containers (mongodb, elasticsearch, custom golang docker image). My Dockerfile has a small script which help me (and which is working) to know when everything is ready for a full test
Dockerfile
FROM golang:1.17.6
WORKDIR /app
ENV GO111MODULE on
# Download wait for it tool.
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /wait-for-it
RUN chmod +x /wait-for-it
docker-compose.tests-e2e.yml
version: "3.7"
services:
mongodb_e2e_tests:
image: mongo:5.0.4
elasticsearch_e2e_tests:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
environment:
- "discovery.type=single-node"
e2e_tests:
build:
context: .
dockerfile: Dockerfile.e2e_tests
environment:
# ...
depends_on:
- mongodb_e2e_tests
- elasticsearch_e2e_tests
volumes:
- .:/app
command: sh -c "/wait-for-it elasticsearch_e2e_tests:9200 -- /wait-for-it mongodb_e2e_tests:27017 -- go test ./tests/e2e/... -p 1 -v -count=1"
Everything seems to work as before, until the go test ./tests/e2e/... -p 1 -v -count=1
which from now on, at go get time, cannot fetch my private repository...
Thanks for any help.. I really did search to inject SSH, so setup git and everything but.. It seems to have something to do with docker-compose... not my Dockerfile image or my golang command
Thanks again..
Best,
Max