Example integration test using Dockertest
Your project directory structure should look like this
+ your_gopath/
|
+--+ src/github.com/moemoe89
| |
| +--+ integration-test-golang/
| |
| +--+ main.go
| + repository/
| |
| +--+ repository.go
| |
| +--+ cassandra
| | |
| | +--+ cassandra.go
| | + cassandra_test.go
| +--+ mysql
| | |
| | +--+ mysql.go
| | + mysql_test.go
| |
| +--+ postgres
| |
| +--+ postgres.go
| + postgres_test.go
|
+--+ bin/
| |
| +-- ... executable file
|
+--+ pkg/
|
+-- ... all dependency_library required
- Setup Golang https://golang.org
- Setup Docker https://www.docker.com
- Under
$GOPATH
, do the following command :
$ mkdir -p src/github.com/moemoe89
$ cd src/github.com/moemoe89
$ git clone <url>
$ mv <cloned directory> integration-test-golang
$ go test ./...
or
$ make test
MIT