Package list golang-github-go-kit-kit / 0ff31a2
Run integration tests on circleci Rodrigo Saito authored 4 years ago Rodrigo Saito committed 4 years ago
4 changed file(s) with 42 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
0 machine:
1 pre:
2 - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
3 services:
4 - docker
5
6 dependencies:
7 pre:
8 - sudo pip install docker-compose
9 - docker-compose -f docker-compose-integration.yml up -d --force-recreate
10
11 test:
12 override:
13 - go test -v -race -tags integration ./...:
14 environment:
15 ETCD_ADDR: http://localhost:2379
16 CONSUL_ADDR: localhost:8500
17 ZK_ADDR: localhost:2181
0 version: '2'
1 services:
2 etcd:
3 image: quay.io/coreos/etcd
4 ports:
5 - "2379:2379"
6 command: /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 -listen-client-urls "http://0.0.0.0:2379,http://0.0.0.0:4001"
7 consul:
8 image: progrium/consul
9 ports:
10 - "8500:8500"
11 command: -server -bootstrap
12 zk:
13 image: zookeeper
14 ports:
15 - "2181:2181"
1313 )
1414
1515 func TestIntegration(t *testing.T) {
16 // Connect to Consul.
17 // docker run -p 8500:8500 progrium/consul -server -bootstrap
18 consulAddr := os.Getenv("CONSUL_ADDRESS")
16 consulAddr := os.Getenv("CONSUL_ADDR")
1917 if consulAddr == "" {
20 t.Fatal("CONSUL_ADDRESS is not set")
18 t.Fatal("CONSUL_ADDR is not set")
2119 }
2220 stdClient, err := stdconsul.NewClient(&stdconsul.Config{
2321 Address: consulAddr,
33
44 import (
55 "bytes"
6 "flag"
7 "fmt"
6 "log"
87 "os"
98 "testing"
109 "time"
1716 )
1817
1918 func TestMain(m *testing.M) {
20 flag.Parse()
21
22 fmt.Println("Starting ZooKeeper server...")
23
24 ts, err := stdzk.StartTestCluster(1, nil, nil)
25 if err != nil {
26 fmt.Printf("ZooKeeper server error: %v\n", err)
27 os.Exit(1)
28 }
29
30 host = []string{fmt.Sprintf("localhost:%d", ts.Servers[0].Port)}
31 code := m.Run()
32
33 ts.Stop()
34 os.Exit(code)
19 zkAddr := os.Getenv("ZK_ADDR")
20 if zkAddr == "" {
21 log.Fatal("ZK_ADDR is not set")
22 }
23 host = []string{zkAddr}
3524 }
3625
3726 func TestCreateParentNodesOnServer(t *testing.T) {