diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 000000000..1f51baab0 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,89 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go: [1.12.17, 1.15.13] + target: + - linux-amd64-fmt + - linux-amd64-integration-1-cpu + - linux-amd64-integration-2-cpu + - linux-amd64-integration-4-cpu + - linux-amd64-functional + - linux-amd64-unit + - all-build + - linux-amd64-grpcproxy + - linux-386-unit + exclude: + - go: 1.12.17 + target: linux-amd64-grpcproxy + - go: 1.12.17 + target: linux-386-unit + - go: 1.15.13 + target: linux-amd64-integration-1-cpu + - go: 1.15.13 + target: linux-amd64-integration-2-cpu + - go: 1.12.17 + target: linux-amd64-unit + - go: 1.15.13 + target: linux-amd64-coverage + - go: 1.12.17 + target: linux-amd64-fmt + - go: 1.15.13 + target: linux-386-unit + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - run: date + - env: + TARGET: ${{ matrix.target }} + GO_VERSION: ${{ matrix.go }} + run: | + RACE='true'; if [[ ${GO_VERSION} == 1.15.13 ]]; then echo 'setting race off'; RACE='false'; fi + echo "${TARGET}" + case "${TARGET}" in + linux-amd64-fmt) + GOARCH=amd64 PASSES='fmt bom dep' ./test + ;; + linux-amd64-integration-1-cpu) + GOARCH=amd64 CPU=1 PASSES='integration' RACE="${RACE}" ./test + ;; + linux-amd64-integration-2-cpu) + GOARCH=amd64 CPU=2 PASSES='integration' RACE="${RACE}" ./test + ;; + linux-amd64-integration-4-cpu) + GOARCH=amd64 CPU=4 PASSES='integration' RACE="${RACE}" ./test + ;; + linux-amd64-functional) + ./build && GOARCH=amd64 PASSES='functional' RACE="${RACE}" ./test + ;; + linux-amd64-unit) + GOARCH=amd64 PASSES='unit' RACE="${RACE}" ./test + ;; + all-build) + GOARCH=amd64 PASSES='build' ./test + GOARCH=386 PASSES='build' ./test + GO_BUILD_FLAGS='-v' GOOS=darwin GOARCH=amd64 ./build + GO_BUILD_FLAGS='-v' GOOS=windows GOARCH=amd64 ./build + GO_BUILD_FLAGS='-v' GOARCH=arm ./build + GO_BUILD_FLAGS='-v' GOARCH=arm64 ./build + GO_BUILD_FLAGS='-v' GOARCH=ppc64le ./build + GO_BUILD_FLAGS='-v' GOARCH=s390x ./build + ;; + linux-amd64-grpcproxy) + PASSES='build grpcproxy' CPU='4' ./test 2>&1 | tee test.log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log + ;; + linux-386-unit) + GOARCH=386 PASSES='unit' ./test + ;; + *) + echo "Failed to find target" + exit 1 + ;; + esac diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d3ac456c..000000000 --- a/.travis.yml +++ /dev/null @@ -1,109 +0,0 @@ -language: go -go_import_path: go.etcd.io/etcd - -sudo: required - -services: docker - -go: -- 1.12.17 -- 1.15.11 - -notifications: - on_success: never - on_failure: never - -env: - matrix: - - TARGET=linux-amd64-fmt - - TARGET=linux-amd64-integration-1-cpu - - TARGET=linux-amd64-integration-2-cpu - - TARGET=linux-amd64-integration-4-cpu - - TARGET=linux-amd64-functional - - TARGET=linux-amd64-unit - - TARGET=all-build - - TARGET=linux-amd64-grpcproxy - - TARGET=linux-386-unit - -matrix: - fast_finish: true - allow_failures: - - go: 1.12.17 - env: TARGET=linux-amd64-grpcproxy - - go: 1.12.17 - env: TARGET=linux-386-unit - exclude: - - go: 1.15.11 - env: TARGET=linux-amd64-integration-1-cpu - - go: 1.15.11 - env: TARGET=linux-amd64-integration-2-cpu - - go: 1.15.11 - env: TARGET=linux-amd64-unit-4-cpu-race - - go: 1.15.11 - env: TARGET=linux-amd64-coverage - - go: 1.15.11 - env: TARGET=linux-amd64-fmt-unit-go-tip-2-cpu - - go: 1.15.11 - env: TARGET=linux-386-unit-1-cpu - -before_install: -- if [[ $TRAVIS_GO_VERSION == 1.* ]]; then docker pull gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION}; fi - -install: -- go get -t -v -d ./... - -script: - - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}" - - RACE='true'; if [[ $TRAVIS_GO_VERSION == 1.15.11 ]]; then echo 'setting race off'; RACE='false'; fi - - > - case "${TARGET}" in - linux-amd64-fmt) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='fmt bom dep' ./test" - ;; - linux-amd64-integration-1-cpu) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 CPU=1 PASSES='integration' RACE='${RACE}' ./test" - ;; - linux-amd64-integration-2-cpu) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 CPU=2 PASSES='integration' RACE='${RACE}' ./test" - ;; - linux-amd64-integration-4-cpu) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 CPU=4 PASSES='integration' RACE='${RACE}' ./test" - ;; - linux-amd64-functional) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "./build && GOARCH=amd64 PASSES='functional' RACE='${RACE}' ./test" - ;; - linux-amd64-unit) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='unit' RACE='${RACE}' ./test" - ;; - all-build) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='build' ./test \ - && GOARCH=386 PASSES='build' ./test \ - && GO_BUILD_FLAGS='-v' GOOS=darwin GOARCH=amd64 ./build \ - && GO_BUILD_FLAGS='-v' GOOS=windows GOARCH=amd64 ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=arm ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=arm64 ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=ppc64le ./build" - ;; - linux-amd64-grpcproxy) - sudo HOST_TMP_DIR=/tmp TEST_OPTS="PASSES='build grpcproxy'" GO_VERSION=${TRAVIS_GO_VERSION} make docker-test - ;; - linux-386-unit) - docker run --rm \ - --volume=`pwd`:/go/src/go.etcd.io/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=386 PASSES='unit' ./test" - ;; - esac diff --git a/etcdctl/ctlv3/command/util.go b/etcdctl/ctlv3/command/util.go index ad7a7cb95..05997604b 100644 --- a/etcdctl/ctlv3/command/util.go +++ b/etcdctl/ctlv3/command/util.go @@ -15,8 +15,8 @@ package command import ( - "crypto/tls" "context" + "crypto/tls" "encoding/hex" "fmt" "io/ioutil" @@ -107,7 +107,7 @@ func endpointMemoryMetrics(host string, scfg *secureCfg) float64 { return 0.0 } http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{ - Certificates: []tls.Certificate{cert}, + Certificates: []tls.Certificate{cert}, InsecureSkipVerify: scfg.insecureSkipVerify, } } diff --git a/test b/test index ae13719b7..5c9b4c005 100755 --- a/test +++ b/test @@ -468,6 +468,7 @@ function govet_shadow_pass { # Golang 1.12 onwards the experimental -shadow option is no longer available with go vet go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow export PATH=${GOPATH}/bin:${PATH} + # shellcheck disable=SC2230 shadow_tool=$(which shadow) vetRes=$(go vet -all -vettool="${shadow_tool}" "${TEST[@]}") if [ -n "${vetRes}" ]; then