mirror of https://github.com/k3s-io/k3s
Improve debugging experience for single integration test case
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
|
||||
```
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue