Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 2.04 KB

README.md

File metadata and controls

46 lines (31 loc) · 2.04 KB

etcd Golang Integration Test Harness

Travis Build Go Report Card GoDoc Apache 2.0 License

Harness code that spins up and manages a local-only etcd server for Go (golang) integration tests.

It is meant to be used with suite-tests, such as testify Suites or gocheck fixtures, to leverage single startup of a test suite.

Features:

  • dynamic port allocation - multiple Harnesses can be run in parallel
  • dynamic data directory - each Harness has an independent data dirctory
  • full etcd server lifecycle management - start, stop and data cleanup
  • uses etcd from $PATH - makes it easy to test against an etcd version you run in production
  • typical boostrap of 400-500ms

Usage

Harness exports the official Golang client bindings under harness.Client. For raw access purposes harness.Endpoint returns the client-side endpoint of the etcd server.

For an example of usage that utilises testify Suites, please see harness_test.go.

Travis CI Configuration

If you're creating an open source project, chances are you're using Travis as your CI. Travis by default places your $GOPATH/bin on the build's $PATH. Since etcd Harness looks for the etcd binary in $PATH, using it is as easy as:

install:
  - go get github.com/coreos/etcd
  - go get github.com/mwitkow/go-etcd-harness
  ...

###License

etcd-harness is under the Apache 2.0 license. See the LICENSE file for details.