|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2019 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -o errexit |
| 18 | +set -o nounset |
| 19 | +set -o pipefail |
| 20 | + |
| 21 | +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. |
| 22 | +source "${KUBE_ROOT}/hack/lib/init.sh" |
| 23 | + |
| 24 | +focus=${FOCUS:-""} |
| 25 | +skip=${SKIP:-""} |
| 26 | +parallelism=${PARALLELISM:-""} |
| 27 | +artifacts=${ARTIFACTS:-"/tmp/_artifacts/$(date +%y%m%dT%H%M%S)"} |
| 28 | +run_until_failure=${RUN_UNTIL_FAILURE:-"false"} |
| 29 | +build=${BUILD:-"true"} |
| 30 | + |
| 31 | +# Parse the flags to pass to ginkgo |
| 32 | +ginkgoflags="" |
| 33 | +if [[ ${parallelism} != "" ]]; then |
| 34 | + ginkgoflags="${ginkgoflags} -nodes=${parallelism} " |
| 35 | +else |
| 36 | + ginkgoflags="${ginkgoflags} -p " |
| 37 | +fi |
| 38 | + |
| 39 | +if [[ ${focus} != "" ]]; then |
| 40 | + ginkgoflags="${ginkgoflags} -focus=\"${focus}\" " |
| 41 | +fi |
| 42 | + |
| 43 | +if [[ ${skip} != "" ]]; then |
| 44 | + ginkgoflags="${ginkgoflags} -skip=\"${skip}\" " |
| 45 | +fi |
| 46 | + |
| 47 | +if [[ ${run_until_failure} != "false" ]]; then |
| 48 | + ginkgoflags="${ginkgoflags} -untilItFails=${run_until_failure} " |
| 49 | +fi |
| 50 | + |
| 51 | +# Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host |
| 52 | +if [[ ! -d "${artifacts}" ]]; then |
| 53 | + echo "Creating artifacts directory at ${artifacts}" |
| 54 | + mkdir -p "${artifacts}" |
| 55 | +fi |
| 56 | +echo "Test artifacts will be written to ${artifacts}" |
| 57 | + |
| 58 | +# Test |
| 59 | +kube::golang::verify_go_version |
| 60 | + |
| 61 | +go run test/e2e_kubeadm/runner/local/run_local.go \ |
| 62 | + --ginkgo-flags="${ginkgoflags}" \ |
| 63 | + --test-flags="--provider=skeleton --report-dir=${artifacts}" \ |
| 64 | + --build="${build}" 2>&1 | tee -i "${artifacts}/build-log.txt" |
0 commit comments