2014-06-06 23:40:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-05-01 16:19:44 +00:00
|
|
|
# Copyright 2014 The Kubernetes Authors All rights reserved.
|
2014-06-06 23:40:48 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2014-10-31 21:14:37 +00:00
|
|
|
# any command line arguments will be passed to hack/build_go.sh to build the
|
|
|
|
# cmd/integration binary. --use_go_build is a legitimate argument, as are
|
|
|
|
# any other build time arguments.
|
|
|
|
|
2014-09-23 16:33:19 +00:00
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
|
2014-10-03 21:58:49 +00:00
|
|
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
2014-10-22 23:26:59 +00:00
|
|
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
2015-09-04 07:06:01 +00:00
|
|
|
# Lists of API Versions of each groups that should be tested, groups are
|
|
|
|
# separated by comma, lists are separated by semicolon. e.g.,
|
|
|
|
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
|
|
|
|
# TODO: It's going to be:
|
2015-10-09 22:19:13 +00:00
|
|
|
# KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
|
2016-02-17 22:06:35 +00:00
|
|
|
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1;v1,autoscaling/v1,batch/v1,extensions/v1beta1"}
|
2015-06-02 17:22:10 +00:00
|
|
|
|
2015-09-26 00:46:02 +00:00
|
|
|
# Give integration tests longer to run
|
|
|
|
KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 240s}
|
2015-04-09 22:05:30 +00:00
|
|
|
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
2015-04-24 01:04:37 +00:00
|
|
|
LOG_LEVEL=${LOG_LEVEL:-2}
|
2014-07-27 05:31:30 +00:00
|
|
|
|
2014-09-23 16:33:19 +00:00
|
|
|
cleanup() {
|
2014-10-22 23:26:59 +00:00
|
|
|
kube::etcd::cleanup
|
|
|
|
kube::log::status "Integration test cleanup complete"
|
2014-09-23 16:33:19 +00:00
|
|
|
}
|
2014-09-23 13:58:32 +00:00
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
runTests() {
|
|
|
|
kube::etcd::start
|
2014-06-06 23:40:48 +00:00
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
kube::log::status "Running integration test cases"
|
2015-06-30 02:30:14 +00:00
|
|
|
|
2015-09-24 16:29:40 +00:00
|
|
|
# TODO: Re-enable race detection when we switch to a thread-safe etcd client
|
|
|
|
# KUBE_RACE="-race"
|
2015-03-18 08:21:10 +00:00
|
|
|
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
2015-09-24 16:29:40 +00:00
|
|
|
KUBE_RACE="" \
|
2015-09-26 00:46:02 +00:00
|
|
|
KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
|
2015-03-20 00:21:08 +00:00
|
|
|
KUBE_TEST_API_VERSIONS="$1" \
|
2016-02-17 22:06:35 +00:00
|
|
|
KUBE_API_VERSIONS="v1,autoscaling/v1,batch/v1,extensions/v1beta1" \
|
2015-03-18 08:21:10 +00:00
|
|
|
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
|
|
|
|
2016-02-11 21:34:04 +00:00
|
|
|
kube::log::status "Running integration test scenario with watch cache on"
|
2016-02-17 22:06:35 +00:00
|
|
|
KUBE_API_VERSIONS="v1,autoscaling/v1,batch/v1,extensions/v1beta1" KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \
|
2016-02-11 21:34:04 +00:00
|
|
|
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=true
|
2014-06-07 04:38:37 +00:00
|
|
|
|
2016-02-11 21:34:04 +00:00
|
|
|
kube::log::status "Running integration test scenario with watch cache off"
|
2016-02-17 22:06:35 +00:00
|
|
|
KUBE_API_VERSIONS="v1,autoscaling/v1,batch/v1,extensions/v1beta1" KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \
|
2016-02-11 21:34:04 +00:00
|
|
|
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=false
|
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
cleanup
|
|
|
|
}
|
2014-06-06 23:40:48 +00:00
|
|
|
|
2016-02-17 22:06:35 +00:00
|
|
|
KUBE_API_VERSIONS="v1,autoscaling/v1,batch/v1,extensions/v1beta1" "${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration
|
2014-10-22 23:26:59 +00:00
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
# Run cleanup to stop etcd on interrupt or other kill signal.
|
|
|
|
trap cleanup EXIT
|
2014-06-06 23:40:48 +00:00
|
|
|
|
2015-03-20 00:21:08 +00:00
|
|
|
# Convert the CSV to an array of API versions to test
|
2015-09-04 07:06:01 +00:00
|
|
|
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
2015-03-20 00:21:08 +00:00
|
|
|
for apiVersion in "${apiVersions[@]}"; do
|
2015-03-26 21:27:42 +00:00
|
|
|
runTests "${apiVersion}"
|
2015-03-20 00:21:08 +00:00
|
|
|
done
|