mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Makefile: initial commit
Initial commit to run DNS/SRV tests. Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
999f329c87
commit
23a302364c
116
Makefile
Normal file
116
Makefile
Normal file
@ -0,0 +1,116 @@
|
||||
# run makefile from repo root
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
GO_BUILD_FLAGS="-v" ./build
|
||||
./bin/etcd --version
|
||||
ETCDCTL_API=3 ./bin/etcdctl version
|
||||
|
||||
# run all tests
|
||||
test-all:
|
||||
RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee test.log
|
||||
|
||||
# clean up failed tests, logs, dependencies
|
||||
clean:
|
||||
rm -f ./*.log
|
||||
rm -f ./bin/Dockerfile-release
|
||||
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:*
|
||||
|
||||
# keep in-sync with 'Dockerfile-test', 'e2e/docker-dns/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:
|
||||
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.log"
|
||||
|
||||
docker-test-386:
|
||||
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.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"
|
||||
|
||||
# TODO: add DNS SRV tests
|
||||
# TODO: add DNS integration tests
|
@ -1,12 +1,18 @@
|
||||
FROM golang:1.9-stretch
|
||||
FROM golang:1.9.1-stretch
|
||||
LABEL Description="Image for etcd DNS testing"
|
||||
RUN apt update -y
|
||||
RUN go get github.com/mattn/goreman
|
||||
RUN apt install -y bind9
|
||||
|
||||
RUN apt update -y \
|
||||
&& apt install -y \
|
||||
bind9 \
|
||||
dnsutils
|
||||
|
||||
RUN mkdir /var/bind
|
||||
RUN chown bind /var/bind
|
||||
ADD Procfile.tls /Procfile.tls
|
||||
ADD run.sh /run.sh
|
||||
|
||||
ADD named.conf etcd.zone rdns.zone /etc/bind/
|
||||
ADD resolv.conf /etc/resolv.conf
|
||||
|
||||
RUN go get github.com/mattn/goreman
|
||||
CMD ["/run.sh"]
|
@ -1,7 +0,0 @@
|
||||
# run makefile from repo root
|
||||
|
||||
docker-dns-build:
|
||||
docker build -t etcd-dns e2e/docker/
|
||||
|
||||
docker-dns-test: docker-dns-build
|
||||
docker run --dns 127.0.0.1 --rm -v `pwd`/bin/:/etcd -v `pwd`/integration/fixtures:/certs -w /etcd -t etcd-dns
|
Loading…
x
Reference in New Issue
Block a user