test-e2e-kubeadm.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. # Copyright 2019 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. set -o errexit
  16. set -o nounset
  17. set -o pipefail
  18. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
  19. source "${KUBE_ROOT}/hack/lib/init.sh"
  20. focus=${FOCUS:-""}
  21. skip=${SKIP:-""}
  22. parallelism=${PARALLELISM:-""}
  23. artifacts=${ARTIFACTS:-"/tmp/_artifacts/$(date +%y%m%dT%H%M%S)"}
  24. run_until_failure=${RUN_UNTIL_FAILURE:-"false"}
  25. build=${BUILD:-"true"}
  26. # Parse the flags to pass to ginkgo
  27. ginkgoflags=""
  28. if [[ ${parallelism} != "" ]]; then
  29. ginkgoflags="${ginkgoflags} -nodes=${parallelism} "
  30. else
  31. ginkgoflags="${ginkgoflags} -p "
  32. fi
  33. if [[ ${focus} != "" ]]; then
  34. ginkgoflags="${ginkgoflags} -focus=\"${focus}\" "
  35. fi
  36. if [[ ${skip} != "" ]]; then
  37. ginkgoflags="${ginkgoflags} -skip=\"${skip}\" "
  38. fi
  39. if [[ ${run_until_failure} != "false" ]]; then
  40. ginkgoflags="${ginkgoflags} -untilItFails=${run_until_failure} "
  41. fi
  42. # Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host
  43. if [[ ! -d "${artifacts}" ]]; then
  44. echo "Creating artifacts directory at ${artifacts}"
  45. mkdir -p "${artifacts}"
  46. fi
  47. echo "Test artifacts will be written to ${artifacts}"
  48. # Test
  49. kube::golang::verify_go_version
  50. go run test/e2e_kubeadm/runner/local/run_local.go \
  51. --ginkgo-flags="${ginkgoflags}" \
  52. --test-flags="--provider=skeleton --report-dir=${artifacts}" \
  53. --build="${build}" 2>&1 | tee -i "${artifacts}/build-log.txt"