forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
182 lines (152 loc) · 6.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# run from repository root
TEST_SUFFIX = $(shell date +%s | base64 | head -c 15)
.PHONY: build
build:
GO_BUILD_FLAGS="-v" ./build
./bin/etcd --version
ETCDCTL_API=3 ./bin/etcdctl version
test:
$(info log-file: test-$(TEST_SUFFIX).log)
PASSES='fmt bom dep compile build unit' ./test 2>&1 | tee test-$(TEST_SUFFIX).log
! grep FAIL -A10 -B50 test-$(TEST_SUFFIX).log
test-all:
$(info log-file: test-all-$(TEST_SUFFIX).log)
RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee test-all-$(TEST_SUFFIX).log
! grep FAIL -A10 -B50 test-all-$(TEST_SUFFIX).log
test-proxy:
$(info log-file: test-proxy-$(TEST_SUFFIX).log)
PASSES='build grpcproxy' ./test 2>&1 | tee test-proxy-$(TEST_SUFFIX).log
! grep FAIL -A10 -B50 test-proxy-$(TEST_SUFFIX).log
test-coverage:
$(info log-file: test-coverage-$(TEST_SUFFIX).log)
COVERDIR=covdir PASSES='build build_cov cov' ./test 2>&1 | tee test-coverage-$(TEST_SUFFIX).log
$(shell curl -s https://codecov.io/bash >codecov)
chmod 700 ./codecov
./codecov -h
./codecov -t 6040de41-c073-4d6f-bbf8-d89256ef31e1
# clean up failed tests, logs, dependencies
clean:
rm -f ./codecov
rm -f ./*.log
rm -f ./bin/Dockerfile-release
rm -rf ./bin/*.etcd
rm -rf ./gopath
rm -rf ./release
rm -f ./integration/127.0.0.1:* ./integration/localhost:*
rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:*
rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:*
# sync with Dockerfile-test, e2e/docker-dns/Dockerfile, e2e/docker-dns-srv/Dockerfile
_GO_VERSION = go1.9.1
ifdef GO_VERSION
_GO_VERSION = $(GO_VERSION)
endif
# build base container image for testing on Linux
docker-test-build:
docker build --tag gcr.io/etcd-development/etcd-test:$(_GO_VERSION) --file ./Dockerfile-test .
# e.g.
# gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd.json)" https://gcr.io
docker-test-push:
gcloud docker -- push gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
docker-test-pull:
docker pull gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
# compile etcd and etcdctl with Linux
docker-test-compile:
docker run \
--rm \
--volume=`pwd`/:/etcd \
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
/bin/bash -c "cd /etcd && GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version"
# run tests inside container
docker-test:
$(info log-file: docker-test-$(TEST_SUFFIX).log)
docker run \
--rm \
--volume=`pwd`:/go/src/github.com/coreos/etcd \
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
/bin/bash -c "RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee docker-test-$(TEST_SUFFIX).log"
! grep FAIL -A10 -B50 docker-test-$(TEST_SUFFIX).log
docker-test-386:
$(info log-file: docker-test-386-$(TEST_SUFFIX).log)
docker run \
--rm \
--volume=`pwd`:/go/src/github.com/coreos/etcd \
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
/bin/bash -c "GOARCH=386 PASSES='build unit integration_e2e' ./test 2>&1 | tee docker-test-386-$(TEST_SUFFIX).log"
! grep FAIL -A10 -B50 docker-test-386-$(TEST_SUFFIX).log
docker-test-proxy:
$(info log-file: docker-test-proxy-$(TEST_SUFFIX).log)
docker run \
--rm \
--volume=`pwd`:/go/src/github.com/coreos/etcd \
gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
/bin/bash -c "PASSES='build grpcproxy' ./test ./test 2>&1 | tee docker-test-proxy-$(TEST_SUFFIX).log"
! grep FAIL -A10 -B50 docker-test-proxy-$(TEST_SUFFIX).log
# build release container image with Linux
_ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound")
ifdef ETCD_VERSION
_ETCD_VERSION = $(ETCD_VERSION)
endif
docker-release-master-build: docker-test-compile
cp ./Dockerfile-release ./bin/Dockerfile-release
docker build \
--tag gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
--file ./bin/Dockerfile-release \
./bin
rm -f ./bin/Dockerfile-release
docker run \
--rm \
gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
/bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version"
docker-release-master-push:
gcloud docker -- push gcr.io/etcd-development/etcd:$(_ETCD_VERSION)
# build base container image for DNS testing
docker-dns-test-build:
docker build \
--tag gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
--file ./e2e/docker-dns/Dockerfile \
./e2e/docker-dns
docker run \
--rm \
--dns 127.0.0.1 \
gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
/bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig etcd.local"
docker-dns-test-push:
gcloud docker -- push gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
docker-dns-test-pull:
docker pull gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
# run DNS tests inside container
docker-dns-test-run:
docker run \
--rm \
--tty \
--dns 127.0.0.1 \
--volume=`pwd`/bin:/etcd \
--volume=`pwd`/integration/fixtures:/certs \
gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
/bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd"
# build base container image for DNS/SRV testing
docker-dns-srv-test-build:
docker build \
--tag gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
--file ./e2e/docker-dns-srv/Dockerfile \
./e2e/docker-dns-srv
docker run \
--rm \
--dns 127.0.0.1 \
gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
/bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig +noall +answer SRV _etcd-client-ssl._tcp.etcd.local && dig +noall +answer SRV _etcd-server-ssl._tcp.etcd.local && dig +noall +answer m1.etcd.local m2.etcd.local m3.etcd.local"
docker-dns-srv-test-push:
gcloud docker -- push gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION)
docker-dns-srv-test-pull:
docker pull gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION)
# run DNS/SRV tests inside container
docker-dns-srv-test-run:
docker run \
--rm \
--tty \
--dns 127.0.0.1 \
--volume=`pwd`/bin:/etcd \
--volume=`pwd`/integration/fixtures:/certs \
gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
/bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd"
# TODO: add DNS integration tests