Skip to content

Commit

Permalink
test/kokoro: enable pod log collection in the buildscripts (#5608) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk authored Sep 8, 2022
1 parent b6e5fff commit 10d96b8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion test/kokoro/psm-security.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ timeout_mins: 180
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
22 changes: 16 additions & 6 deletions test/kokoro/psm-security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,20 @@ run_test() {
# 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}"
set -x
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
--kube_context="${KUBE_CONTEXT}" \
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--nocheck_local_certs \
--force_cleanup \
--nocheck_local_certs
set +x
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
Expand Down Expand Up @@ -151,9 +155,15 @@ main() {
build_docker_images_if_needed
# Run tests
cd "${TEST_DRIVER_FULL_DIR}"
run_test baseline_test
run_test security_test
run_test authz_test
local failed_tests=0
test_suites=("baseline_test" "security_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 "$@"
2 changes: 1 addition & 1 deletion test/kokoro/xds_k8s_lb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ timeout_mins: 180
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
10 changes: 7 additions & 3 deletions test/kokoro/xds_k8s_lb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ run_test() {
# Test driver 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 out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
Expand All @@ -108,9 +110,11 @@ run_test() {
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--force_cleanup
set +x
--force_cleanup \
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
Expand Down
2 changes: 1 addition & 1 deletion test/kokoro/xds_url_map.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ timeout_mins: 60
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"
regex: "artifacts/**/*sponge_log.log"
regex: "artifacts/**/*.log"
strip_prefix: "artifacts"
}
}
10 changes: 7 additions & 3 deletions test/kokoro/xds_url_map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,19 @@ run_test() {
# Test driver 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 out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
mkdir -pv "${out_dir}"
set -x
python -m "tests.${test_name}" \
--flagfile="${TEST_DRIVER_FLAGFILE}" \
--flagfile="config/url-map.cfg" \
--kube_context="${KUBE_CONTEXT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--testing_version="${TESTING_VERSION}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
--flagfile="config/url-map.cfg"
set +x
--collect_app_logs \
--log_dir="${out_dir}" \
--xml_output_file="${out_dir}/sponge_log.xml" \
|& tee "${out_dir}/sponge_log.log"
}

#######################################
Expand Down

0 comments on commit 10d96b8

Please sign in to comment.