gotest.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Copyright 2015 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Runs the unit and integration tests, production JUnit-style XML test reports
  16. # in ${WORKSPACE}/_artifacts.
  17. set -o errexit
  18. set -o nounset
  19. set -o pipefail
  20. set -o xtrace
  21. # !!! ALERT !!! Jenkins default $HOME is /var/lib/jenkins, which is
  22. # global across jobs. We change $HOME instead to ${WORKSPACE}, which
  23. # is an incoming variable Jenkins provides us for this job's scratch
  24. # space.
  25. export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
  26. export GOPATH=${HOME}/_gopath
  27. export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:$PATH
  28. # Install a few things needed by unit and /integration tests.
  29. command -v etcd &>/dev/null || ./hack/install-etcd.sh
  30. go get -u github.com/jstemmer/go-junit-report
  31. # Enable the Go race detector.
  32. export KUBE_RACE=-race
  33. # Produce a JUnit-style XML test report for Jenkins.
  34. export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/_artifacts
  35. # Save the verbose stdout as well.
  36. export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y
  37. make test
  38. make test-integration