mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Improve debugging experience for single integration test case
This commit is contained in:
parent
15213d0a1c
commit
25f25cbafd
@ -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
|
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.
|
printed to stdout.
|
||||||
|
|
||||||
To run tests and collect coverage in only one package, pass its relative path
|
To run tests and collect coverage in only one package, pass its relative path
|
||||||
|
@ -37,28 +37,34 @@ KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1;v1,autos
|
|||||||
KUBE_TIMEOUT="-timeout 600s"
|
KUBE_TIMEOUT="-timeout 600s"
|
||||||
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
||||||
LOG_LEVEL=${LOG_LEVEL:-2}
|
LOG_LEVEL=${LOG_LEVEL:-2}
|
||||||
|
KUBE_TEST_ARGS=${KUBE_TEST_ARGS:-}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
kube::log::status "Cleaning up etcd"
|
||||||
kube::etcd::cleanup
|
kube::etcd::cleanup
|
||||||
kube::log::status "Integration test cleanup complete"
|
kube::log::status "Integration test cleanup complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
runTests() {
|
runTests() {
|
||||||
|
kube::log::status "Starting etcd instance"
|
||||||
kube::etcd::start
|
kube::etcd::start
|
||||||
|
|
||||||
kube::log::status "Running integration test cases"
|
kube::log::status "Running integration test cases"
|
||||||
|
|
||||||
# TODO: Re-enable race detection when we switch to a thread-safe etcd client
|
# TODO: Re-enable race detection when we switch to a thread-safe etcd client
|
||||||
# KUBE_RACE="-race"
|
# KUBE_RACE="-race"
|
||||||
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
KUBE_GOFLAGS="${KUBE_GOFLAGS:-} -tags 'integration no-docker'" \
|
||||||
KUBE_RACE="" \
|
KUBE_RACE="" \
|
||||||
KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
|
KUBE_TIMEOUT="${KUBE_TIMEOUT}" \
|
||||||
KUBE_TEST_API_VERSIONS="$1" \
|
KUBE_TEST_API_VERSIONS="$1" \
|
||||||
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
||||||
|
|
||||||
|
# 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::log::status "Running integration test scenario with watch cache on"
|
||||||
KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \
|
KUBE_TEST_API_VERSIONS="$1" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} \
|
||||||
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=true
|
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}" --watch-cache=true
|
||||||
|
fi
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
@ -73,12 +79,16 @@ checkEtcdOnPath() {
|
|||||||
|
|
||||||
checkEtcdOnPath
|
checkEtcdOnPath
|
||||||
|
|
||||||
|
|
||||||
"${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration
|
"${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration
|
||||||
|
|
||||||
# Run cleanup to stop etcd on interrupt or other kill signal.
|
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||||
trap cleanup EXIT
|
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
|
# Convert the CSV to an array of API versions to test
|
||||||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
|
||||||
for apiVersion in "${apiVersions[@]}"; do
|
for apiVersion in "${apiVersions[@]}"; do
|
||||||
|
Loading…
Reference in New Issue
Block a user