2014-06-06 23:40:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# 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-03-20 00:21:08 +00:00
|
|
|
# Comma separated list of API Versions that should be tested.
|
|
|
|
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1beta1,v1beta3"}
|
2015-04-09 22:05:30 +00:00
|
|
|
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
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"
|
|
|
|
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
|
|
|
KUBE_RACE="-race" \
|
2015-03-20 00:21:08 +00:00
|
|
|
KUBE_TEST_API_VERSIONS="$1" \
|
2015-03-18 08:21:10 +00:00
|
|
|
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
|
|
|
|
|
|
|
kube::log::status "Running integration test scenario"
|
2014-06-07 04:38:37 +00:00
|
|
|
|
2015-04-09 22:05:30 +00:00
|
|
|
"${KUBE_OUTPUT_HOSTBIN}/integration" --v=2 --apiVersion="$1" \
|
|
|
|
--maxConcurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}"
|
2014-06-06 23:40:48 +00:00
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
cleanup
|
|
|
|
}
|
2014-06-06 23:40:48 +00:00
|
|
|
|
2015-03-18 08:21:10 +00:00
|
|
|
"${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-03-26 21:27:42 +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
|