Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # run makefile from repo root
  2. .PHONY: build
  3. build:
  4. GO_BUILD_FLAGS="-v" ./build
  5. ./bin/etcd --version
  6. ETCDCTL_API=3 ./bin/etcdctl version
  7. # run all tests
  8. test-all:
  9. RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee test.log
  10. test-proxy:
  11. PASSES='build grpcproxy' ./test 2>&1 | tee test-proxy.log
  12. test-coverage:
  13. COVERDIR=covdir PASSES='build build_cov cov' ./test 2>&1 | tee test-coverage.log
  14. $(shell curl -s https://codecov.io/bash >codecov)
  15. chmod 700 ./codecov
  16. ./codecov -h
  17. ./codecov -t 6040de41-c073-4d6f-bbf8-d89256ef31e1
  18. # clean up failed tests, logs, dependencies
  19. clean:
  20. rm -f ./codecov
  21. rm -f ./*.log
  22. rm -f ./bin/Dockerfile-release
  23. rm -rf ./bin/*.etcd
  24. rm -rf ./gopath
  25. rm -rf ./release
  26. rm -f ./integration/127.0.0.1:* ./integration/localhost:*
  27. rm -f ./clientv3/integration/127.0.0.1:* ./clientv3/integration/localhost:*
  28. rm -f ./clientv3/ordering/127.0.0.1:* ./clientv3/ordering/localhost:*
  29. # keep in-sync with 'Dockerfile-test', 'e2e/docker-dns/Dockerfile',
  30. # 'e2e/docker-dns-srv/Dockerfile'
  31. _GO_VERSION = go1.9.1
  32. ifdef GO_VERSION
  33. _GO_VERSION = $(GO_VERSION)
  34. endif
  35. # build base container image for testing on Linux
  36. docker-test-build:
  37. docker build --tag gcr.io/etcd-development/etcd-test:$(_GO_VERSION) --file ./Dockerfile-test .
  38. # e.g.
  39. # gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd.json)" https://gcr.io
  40. docker-test-push:
  41. gcloud docker -- push gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  42. docker-test-pull:
  43. docker pull gcr.io/etcd-development/etcd-test:$(_GO_VERSION)
  44. # compile etcd and etcdctl with Linux
  45. docker-test-compile:
  46. docker run \
  47. --rm \
  48. --volume=`pwd`/:/etcd \
  49. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  50. /bin/bash -c "cd /etcd && GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version"
  51. # run tests inside container
  52. docker-test:
  53. docker run \
  54. --rm \
  55. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  56. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  57. /bin/bash -c "RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' ./test 2>&1 | tee docker-test.log"
  58. docker-test-386:
  59. docker run \
  60. --rm \
  61. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  62. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  63. /bin/bash -c "GOARCH=386 PASSES='build unit integration_e2e' ./test 2>&1 | tee docker-test.log"
  64. docker-test-proxy:
  65. docker run \
  66. --rm \
  67. --volume=`pwd`:/go/src/github.com/coreos/etcd \
  68. gcr.io/etcd-development/etcd-test:$(_GO_VERSION) \
  69. /bin/bash -c "PASSES='build grpcproxy' ./test ./test 2>&1 | tee docker-test.log"
  70. # build release container image with Linux
  71. _ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound")
  72. ifdef ETCD_VERSION
  73. _ETCD_VERSION = $(ETCD_VERSION)
  74. endif
  75. docker-release-master-build: docker-test-compile
  76. cp ./Dockerfile-release ./bin/Dockerfile-release
  77. docker build \
  78. --tag gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  79. --file ./bin/Dockerfile-release \
  80. ./bin
  81. rm -f ./bin/Dockerfile-release
  82. docker run \
  83. --rm \
  84. gcr.io/etcd-development/etcd:$(_ETCD_VERSION) \
  85. /bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version"
  86. docker-release-master-push:
  87. gcloud docker -- push gcr.io/etcd-development/etcd:$(_ETCD_VERSION)
  88. # build base container image for DNS testing
  89. docker-dns-test-build:
  90. docker build \
  91. --tag gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  92. --file ./e2e/docker-dns/Dockerfile \
  93. ./e2e/docker-dns
  94. docker run \
  95. --rm \
  96. --dns 127.0.0.1 \
  97. gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  98. /bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig etcd.local"
  99. docker-dns-test-push:
  100. gcloud docker -- push gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
  101. docker-dns-test-pull:
  102. docker pull gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION)
  103. # run DNS tests inside container
  104. docker-dns-test-run:
  105. docker run \
  106. --rm \
  107. --tty \
  108. --dns 127.0.0.1 \
  109. --volume=`pwd`/bin:/etcd \
  110. --volume=`pwd`/integration/fixtures:/certs \
  111. gcr.io/etcd-development/etcd-dns-test:$(_GO_VERSION) \
  112. /bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd"
  113. # build base container image for DNS/SRV testing
  114. docker-dns-srv-test-build:
  115. docker build \
  116. --tag gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
  117. --file ./e2e/docker-dns-srv/Dockerfile \
  118. ./e2e/docker-dns-srv
  119. docker run \
  120. --rm \
  121. --dns 127.0.0.1 \
  122. gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
  123. /bin/bash -c "/etc/init.d/bind9 start && cat /dev/null >/etc/hosts && dig +noall +answer SRV _etcd-client._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-client-ssl._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-server._tcp.etcd-srv.local && dig +noall +answer SRV _etcd-server-ssl._tcp.etcd-srv.local && dig +noall +answer m1.etcd-srv.local m2.etcd-srv.local m3.etcd-srv.local"
  124. docker-dns-srv-test-push:
  125. gcloud docker -- push gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION)
  126. docker-dns-srv-test-pull:
  127. docker pull gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION)
  128. # run DNS/SRV tests inside container
  129. docker-dns-srv-test-run:
  130. docker run \
  131. --rm \
  132. --tty \
  133. --dns 127.0.0.1 \
  134. --volume=`pwd`/bin:/etcd \
  135. gcr.io/etcd-development/etcd-dns-srv-test:$(_GO_VERSION) \
  136. /bin/bash -c "cd /etcd && /run.sh && rm -rf m*.etcd"
  137. # TODO: run DNS/SRV with TLS
  138. # TODO: add DNS integration tests