xDS interop: enable pod log collection in the buildscripts (#9495)

- Enables pod log collection in all PSM interop jobs implemented
  in https://github.com/grpc/grpc/pull/30594.
- Associate test suite runs with their own log file, so it's displayed
  on the "Target Log" tab
- Updates security job to not stop after a failed suite, so that
  authz_test run even if security_test failed
- Fix run_test not returning correct exit status, causing false
  positives in some cases. See https://github.com/grpc/grpc/pull/30768
This commit is contained in:
Sergii Tkachenko 2022-09-06 11:18:27 -07:00 committed by GitHub
parent c27f2d5a57
commit c8c3d3d6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 15 deletions

View File

@ -7,7 +7,7 @@ timeout_mins: 180
action { action {
define_artifacts { define_artifacts {
regex: "artifacts/**/*sponge_log.xml" regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log" regex: "artifacts/**/*.log"
strip_prefix: "artifacts" strip_prefix: "artifacts"
} }
} }

View File

@ -119,6 +119,8 @@ run_test() {
# Test driver usage: # Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage # https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}" local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x set -x
python -m "tests.${test_name}" \ python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \ --flagfile="${TEST_DRIVER_FLAGFILE}" \
@ -126,9 +128,11 @@ run_test() {
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \ --server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \ --client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \ --testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \ --force_cleanup \
--force_cleanup --collect_app_logs \
set +x --log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
} }
####################################### #######################################
@ -170,9 +174,15 @@ main() {
build_docker_images_if_needed build_docker_images_if_needed
# Run tests # Run tests
cd "${TEST_DRIVER_FULL_DIR}" cd "${TEST_DRIVER_FULL_DIR}"
run_test baseline_test local failed_tests=0
run_test security_test test_suites=("baseline_test" "security_test" "authz_test")
run_test authz_test for test in "${test_suites[@]}"; do
run_test $test || (( failed_tests++ ))
done
echo "Failed test suites: ${failed_tests}"
if (( failed_tests > 0 )); then
exit 1
fi
} }
main "$@" main "$@"

View File

@ -7,7 +7,7 @@ timeout_mins: 180
action { action {
define_artifacts { define_artifacts {
regex: "artifacts/**/*sponge_log.xml" regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log" regex: "artifacts/**/*.log"
strip_prefix: "artifacts" strip_prefix: "artifacts"
} }
} }

View File

@ -118,6 +118,8 @@ run_test() {
# Test driver usage: # Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage # https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}" local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x set -x
python -m "tests.${test_name}" \ python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \ --flagfile="${TEST_DRIVER_FLAGFILE}" \
@ -126,9 +128,11 @@ run_test() {
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \ --server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \ --client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \ --testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \ --force_cleanup \
--force_cleanup --collect_app_logs \
set +x --log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
} }
####################################### #######################################

View File

@ -7,7 +7,7 @@ timeout_mins: 90
action { action {
define_artifacts { define_artifacts {
regex: "artifacts/**/*sponge_log.xml" regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log" regex: "artifacts/**/*.log"
strip_prefix: "artifacts" strip_prefix: "artifacts"
} }
} }

View File

@ -118,15 +118,19 @@ run_test() {
# Test driver usage: # Test driver usage:
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage # https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
local test_name="${1:?Usage: run_test test_name}" local test_name="${1:?Usage: run_test test_name}"
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x set -x
python -m "tests.${test_name}" \ python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \ --flagfile="${TEST_DRIVER_FLAGFILE}" \
--flagfile="config/url-map.cfg" \
--kube_context="${KUBE_CONTEXT}" \ --kube_context="${KUBE_CONTEXT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \ --client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \ --testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \ --collect_app_logs \
--flagfile="config/url-map.cfg" --log_dir="${out_dir}" \
set +x --xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
} }
####################################### #######################################