From 25f25cbafd8aabe32bce2ab8d6b652b9c622e19b Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Mon, 13 Jun 2016 15:11:02 -0400 Subject: [PATCH] Improve debugging experience for single integration test case --- docs/devel/testing.md | 2 +- hack/test-integration.sh | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/devel/testing.md b/docs/devel/testing.md index c0e622f381b..13127609219 100644 --- a/docs/devel/testing.md +++ b/docs/devel/testing.md @@ -146,7 +146,7 @@ To run all unit tests and generate an HTML coverage report, run the following: KUBE_COVER=y hack/test-go.sh ``` -At the end of the run, an the HTML report will be generated with the path +At the end of the run, an HTML report will be generated with the path printed to stdout. To run tests and collect coverage in only one package, pass its relative path diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 9f47d1e257a..3105122f38b 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -37,28 +37,34 @@ KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1;v1,autos KUBE_TIMEOUT="-timeout 600s" KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"} LOG_LEVEL=${LOG_LEVEL:-2} +KUBE_TEST_ARGS=${KUBE_TEST_ARGS:-} cleanup() { + kube::log::status "Cleaning up etcd" kube::etcd::cleanup kube::log::status "Integration test cleanup complete" } runTests() { + kube::log::status "Starting etcd instance" kube::etcd::start - kube::log::status "Running integration test cases" # TODO: Re-enable race detection when we switch to a thread-safe etcd client # KUBE_RACE="-race" - KUBE_GOFLAGS="-tags 'integration no-docker' " \ + KUBE_GOFLAGS="${KUBE_GOFLAGS:-} -tags 'integration no-docker'" \ KUBE_RACE="" \ KUBE_TIMEOUT="${KUBE_TIMEOUT}" \ KUBE_TEST_API_VERSIONS="$1" \ "${KUBE_ROOT}/hack/test-go.sh" test/integration - kube::log::status "Running integration test scenario with watch cache on" - KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \ - --max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=true + # Run the watch cache tests + # KUBE_TEST_ARGS doesn't mean anything to the watch cache test. + if [[ -z "${KUBE_TEST_ARGS}" ]]; then + kube::log::status "Running integration test scenario with watch cache on" + KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \ + --max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=true + fi cleanup } @@ -73,12 +79,16 @@ checkEtcdOnPath() { checkEtcdOnPath - "${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration # Run cleanup to stop etcd on interrupt or other kill signal. trap cleanup EXIT +# If a test case is specified, just run once with v1 API version and exit +if [[ -n "${KUBE_TEST_ARGS}" ]]; then + runTests v1 +fi + # Convert the CSV to an array of API versions to test IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}" for apiVersion in "${apiVersions[@]}"; do