https://github.com/mwitkow/go-etcd-harness
Go (golang) Integration Test Harness for etcd
https://github.com/mwitkow/go-etcd-harness
etcd go golang test testify-suites
Last synced: about 1 year ago
JSON representation
Go (golang) Integration Test Harness for etcd
- Host: GitHub
- URL: https://github.com/mwitkow/go-etcd-harness
- Owner: mwitkow
- License: apache-2.0
- Created: 2016-03-22T10:08:31.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-26T08:48:42.000Z (over 10 years ago)
- Last Synced: 2025-03-22T06:51:20.268Z (over 1 year ago)
- Topics: etcd, go, golang, test, testify-suites
- Language: Go
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# etcd Golang Integration Test Harness
[](https://travis-ci.org/mwitkow/go-etcd-harness)
[](http://goreportcard.com/report/mwitkow/go-etcd-harness)
[](https://godoc.org/github.com/mwitkow/go-etcd-harness)
[](LICENSE)
Harness code that spins up and manages a local-only [etcd](https://github.com/coreos/etcd) server for Go (golang)
integration tests.
It is meant to be used with suite-tests, such as [testify Suites](https://godoc.org/github.com/stretchr/testify/suite) or [gocheck fixtures](https://labix.org/gocheck),
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](https://godoc.org/github.com/coreos/etcd/client) 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](https://godoc.org/github.com/stretchr/testify/suite), please see
[harness_test.go](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:
```yaml
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](LICENSE) file for details.