Skip to content

Commit

Permalink
Enable race detection during tests
Browse files Browse the repository at this point in the history
Enable the Go race detector to help surface race conditions when
running the tests.

The race detector currently depends on libc, so does not work with
Alpine Linux (which uses musl):

golang/go#9918
golang/go#14481

Instead, use the default Go Docker image, which uses the libc-based
Debian Jessie and update the Dockerfiles accordingly.
  • Loading branch information
mattbostock committed Jul 17, 2017
1 parent ad83cb9 commit 9ef580c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM golang:1.8-alpine
FROM golang:1.8
MAINTAINER Matt Bostock <[email protected]>

EXPOSE 9080

WORKDIR /go/src/github.com/mattbostock/athensdb
COPY . /go/src/github.com/mattbostock/athensdb

RUN apk add --no-cache git make && \
RUN apt-get update && \
apt-get install -y git make && \
make && \
apk del make && \
apt-get purge -y git make && \
cd && \
rm -rf /go/src

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ savedeps:
@govendor add +external

test:
@go test $(shell go list ./... | grep -v /vendor/)
@go test -race $(shell go list ./... | grep -v /vendor/)

servedocs:
@docker run --rm -it -p 8000:8000 -v `pwd`:/docs squidfunk/mkdocs-material:$(MKDOCS_MATERIAL_VERSION)
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.8-alpine
FROM golang:1.8
MAINTAINER Matt Bostock <[email protected]>

WORKDIR /go/src/github.com/mattbostock/athensdb
COPY . /go/src/github.com/mattbostock/athensdb

RUN go test -c -o /bin/athensdb.test -tags integration ./integration_tests && \
RUN go test -c -o /bin/athensdb.test -race -tags integration ./integration_tests && \
cd /bin && \
rm -rf /go/src

Expand Down

0 comments on commit 9ef580c

Please sign in to comment.