Skip to content

Commit 0c32c22

Browse files
authored
Merge pull request kubernetes#75546 from fabriziopandini/e2e-kubeadm-first-class
Implement make test-e2e-kubeadm
2 parents ca1e470 + 2cb2a97 commit 0c32c22

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

build/root/Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,36 @@ test-e2e-node: ginkgo generated_files
279279
hack/make-rules/test-e2e-node.sh
280280
endif
281281

282+
define TEST_E2E_KUBEADM_HELP_INFO
283+
# Build and run kubeadm end-to-end tests.
284+
#
285+
# Args:
286+
# FOCUS: Regexp that matches the tests to be run. Defaults to "".
287+
# SKIP: Regexp that matches the tests that needs to be skipped. Defaults
288+
# to "".
289+
# RUN_UNTIL_FAILURE: If true, pass --untilItFails to ginkgo so tests are run
290+
# repeatedly until they fail. Defaults to false.
291+
# ARTIFACTS: Local directory to save test artifacts into. Defaults to "/tmp/_artifacts".
292+
# PARALLELISM: The number of gingko nodes to run. If empty ginkgo default
293+
# parallelism (cores - 1) is used
294+
# BUILD: Build kubeadm end-to-end tests. Defaults to true.
295+
#
296+
# Example:
297+
# make test-e2e-kubeadm
298+
# make test-e2e-kubeadm FOCUS=kubeadm-config
299+
# make test-e2e-kubeadm SKIP=kubeadm-config
300+
#
301+
# Build and run tests.
302+
endef
303+
.PHONY: test-e2e-kubeadm
304+
ifeq ($(PRINT_HELP),y)
305+
test-e2e-kubeadm:
306+
@echo "$$TEST_E2E_KUBEADM_HELP_INFO"
307+
else
308+
test-e2e-kubeadm:
309+
hack/make-rules/test-e2e-kubeadm.sh
310+
endif
311+
282312
define TEST_CMD_HELP_INFO
283313
# Build and run cmdline tests.
284314
#
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

Comments
 (0)