Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker containers for tests and linters. #775

Merged
merged 1 commit into from
May 30, 2017

Conversation

jcvernaleo
Copy link
Member

goclean has been replaced with run_tests.sh
which can run tests locally or in a docker image.

Closes #774

run_tests.sh Outdated
@@ -0,0 +1,55 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make this #!/usr/bin/env bash instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually do that. Not sure why I didn't do it here.

@jrick
Copy link
Member

jrick commented May 30, 2017

I'm happy with the idea of this change but can't seem to get it working on windows (WSL). The container starts up perfectly fine but then hits a glide error.

$ DOCKER_HOST=tcp://127.0.0.1:2375 ./run_tests.sh
+ GOVERSION=1.8
+ REPO=dcrwallet
+ TESTCMD='test -z "$(gometalinter -j 4 --disable-all   --enable=gofmt   --enable=gosimple   --enable=unconvert   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''testdata/'\'' | tee /dev/stderr)" &&   test -z "$(gometalinter -j 4 --disable-all   --enable=golint   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''(ALL_CAPS|OP_|NewFieldVal|RpcCommand|RpcRawCommand|RpcSend|Dns|api.pb.go|StartConsensusRpc|factory_test.go|legacy|UnstableAPI|_string.go)'\'' | tee /dev/stderr)" &&   test -z "$(gometalinter -j 4 --disable-all   --enable=vet   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''not a string in call to [A-Za-z]+f'\'' | tee /dev/stderr)" &&   env GORACE='\''halt_on_error=1'\'' go test -short -race $(glide novendor)'
+ '[' 1.8 == local ']'
+ DOCKER_IMAGE_TAG=decred-golang-builder-1.8
+ docker pull decred/decred-golang-builder-1.8
Using default tag: latest
latest: Pulling from decred/decred-golang-builder-1.8
Digest: sha256:e7cefbc0b91991c197e20515813652cf69a501ffdb534196845f0506052b40f7
Status: Image is up to date for decred/decred-golang-builder-1.8:latest
++ pwd
+ docker run --rm -it -v /mnt/c/Users/jrick/Go/src/github.com/decred/dcrwallet:/src decred/decred-golang-builder-1.8 /bin/bash -c '  rsync -ra --filter='\'':- .gitignore'\''    /src/ /go/src/github.com/decred/dcrwallet/ &&   cd github.com/decred/dcrwallet/ &&   glide install &&   go install $(glide novendor) &&   test -z "$(gometalinter -j 4 --disable-all   --enable=gofmt   --enable=gosimple   --enable=unconvert   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''testdata/'\'' | tee /dev/stderr)" &&   test -z "$(gometalinter -j 4 --disable-all   --enable=golint   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''(ALL_CAPS|OP_|NewFieldVal|RpcCommand|RpcRawCommand|RpcSend|Dns|api.pb.go|StartConsensusRpc|factory_test.go|legacy|UnstableAPI|_string.go)'\'' | tee /dev/stderr)" &&   test -z "$(gometalinter -j 4 --disable-all   --enable=vet   --vendor   --deadline=10m ./... 2>&1 | egrep -v '\''not a string in call to [A-Za-z]+f'\'' | tee /dev/stderr)" &&   env GORACE='\''halt_on_error=1'\'' go test -short -race $(glide novendor)
'
[ERROR] Failed to find glide.yaml file in directory tree: Cannot resolve parent of /

@jrick
Copy link
Member

jrick commented May 30, 2017

Related to microsoft/WSL#1854

Docker for windows doesn't understand the /mnt/c/ path being returned by pwd. A workaround is to symlink /mnt/c to /c and then execute the script from the repo path under /c.

goclean has been replaced with run_tests.sh
which can run tests locally or in a docker image.
@jcvernaleo jcvernaleo merged commit 7f64827 into decred:master May 30, 2017
@jcvernaleo jcvernaleo deleted the jcv_docker branch May 30, 2017 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants