-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Hashicorp testutil for testing vs Consul API where required
The behaviors we're testing in the consul package are very thin wrappers around the upstream Consul API library, but that library doesn't have a interfaces (in the golang sense) that we can mock. Using httptest with a test server could give us the HTTP server but not the stateful behaviors without having to implement a lot of Consul's own behavior and we'd have to build code generation in order to validate it. Here we'll use Hashi's own test infrastructure around Consul to run the Consul binary and tear it down after tests. This lets us run locally without Docker and makes it clear where the boundary of tests that depend on the server lies. In future work we can try to minimize this test region and try to eliminate the requirement or move these pieces into integration tests.
- Loading branch information
Showing
3 changed files
with
72 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
FROM golang:1.8 | ||
|
||
RUN go get github.com/golang/lint/golint \ | ||
&& curl -Lo /tmp/glide.tgz https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz \ | ||
&& tar -C /usr/bin -xzf /tmp/glide.tgz --strip=1 linux-amd64/glide | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y unzip \ | ||
&& go get github.com/golang/lint/golint \ | ||
&& curl -Lo /tmp/glide.tgz "https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz" \ | ||
&& tar -C /usr/bin -xzf /tmp/glide.tgz --strip=1 linux-amd64/glide \ | ||
&& curl --fail -Lso consul.zip "https://releases.hashicorp.com/consul/0.7.5/consul_0.7.5_linux_amd64.zip" \ | ||
&& unzip consul.zip -d /usr/bin | ||
|
||
ENV CGO_ENABLED 0 | ||
ENV GOPATH /go:/cp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters