Skip to content

Commit e969820

Browse files
committed
fix psm::tools::print_test_flags args and improve missing argument err
1 parent 41b5171 commit e969820

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.kokoro/psm_interop_kokoro_lib.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ psm::lb::get_tests() {
9494
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
9595
#######################################
9696
psm::lb::run_test() {
97-
local test_name="${1:?missing the test name argument}"
97+
local test_name="${1:?${FUNCNAME[0]} missing the test name argument}"
9898
psm::tools::print_test_flags "${test_name}"
9999
psm::tools::run_verbose python -m "tests.${test_name}" "${PSM_TEST_FLAGS[@]}"
100100
}
@@ -135,14 +135,14 @@ psm::security::get_tests() {
135135
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
136136
#######################################
137137
psm::security::run_test() {
138-
local test_name="${1:?missing the test name argument}"
138+
local test_name="${1:?${FUNCNAME[0]} missing the test name argument}"
139139

140140
# Only java supports extra checks for certificate matches (via channelz socket info).
141141
if [[ "${GRPC_LANGUAGE}" != "java" ]]; then
142142
PSM_TEST_FLAGS+=("--nocheck_local_certs")
143143
fi
144144

145-
psm::tools::print_test_flags
145+
psm::tools::print_test_flags "${test_name}"
146146
psm::tools::run_verbose python -m "tests.${test_name}" "${PSM_TEST_FLAGS[@]}"
147147
}
148148

@@ -177,11 +177,11 @@ psm::url_map::get_tests() {
177177
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
178178
#######################################
179179
psm::url_map::run_test() {
180-
local test_name="${1:?missing the test name argument}"
180+
local test_name="${1:?${FUNCNAME[0]} missing the test name argument}"
181181
PSM_TEST_FLAGS+=(
182182
"--flagfile=config/url-map.cfg"
183183
)
184-
psm::tools::print_test_flags
184+
psm::tools::print_test_flags "${test_name}"
185185
psm::tools::run_verbose python -m "tests.${test_name}" "${PSM_TEST_FLAGS[@]}"
186186
}
187187

@@ -223,11 +223,11 @@ psm::csm::get_tests() {
223223
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
224224
#######################################
225225
psm::csm::run_test() {
226-
local test_name="${1:?missing the test name argument}"
226+
local test_name="${1:?${FUNCNAME[0]} missing the test name argument}"
227227
PSM_TEST_FLAGS+=(
228228
"--flagfile=config/common-csm.cfg"
229229
)
230-
psm::tools::print_test_flags
230+
psm::tools::print_test_flags "${test_name}"
231231
psm::tools::run_verbose python -m "tests.${test_name}" "${PSM_TEST_FLAGS[@]}"
232232
}
233233

@@ -255,7 +255,7 @@ psm::csm::run_test() {
255255
# Writes the output of test execution to stdout, stderr
256256
#######################################
257257
psm::run() {
258-
local test_suite="${1:?missing the test suite argument}"
258+
local test_suite="${1:?${FUNCNAME[0]} missing the test suite argument}"
259259
psm::setup::docker_image_names "${GRPC_LANGUAGE}" "${test_suite}"
260260

261261
case "${test_suite}" in
@@ -281,7 +281,7 @@ psm::run() {
281281
# TBD
282282
#######################################
283283
psm::run::test_suite() {
284-
local test_suite="${1:?missing the test suite argument}"
284+
local test_suite="${1:?${FUNCNAME[0]} missing the test suite argument}"
285285
cd "${TEST_DRIVER_FULL_DIR}"
286286
local failed_tests=0
287287
for test_name in "${TESTS[@]}"; do
@@ -311,8 +311,8 @@ psm::run::test_suite() {
311311
#######################################
312312
psm::run::test() {
313313
# Test driver usage: https://github.com/grpc/psm-interop#basic-usage
314-
local test_suite="${1:?missing the test suite argument}"
315-
local test_name="${2:?missing the test name argument}"
314+
local test_suite="${1:?${FUNCNAME[0]} missing the test suite argument}"
315+
local test_name="${2:?${FUNCNAME[0]} missing the test name argument}"
316316
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
317317
local test_log="${out_dir}/sponge_log.log"
318318
mkdir -p "${out_dir}"
@@ -346,7 +346,7 @@ psm::run::test() {
346346
# --- Common test setup logic -----------
347347

348348
psm::setup::generic_test_suite() {
349-
local test_suite="${1:?missing the test suite argument}"
349+
local test_suite="${1:?${FUNCNAME[0]} missing the test suite argument}"
350350
"psm::${test_suite}::setup"
351351
psm::setup::test_driver
352352
psm::build::docker_images_if_needed
@@ -372,8 +372,8 @@ psm::setup::generic_test_suite() {
372372
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
373373
#######################################
374374
psm::setup::docker_image_names() {
375-
local language="${1:?missing the language argument}"
376-
local test_suite="${2:?missing the test suite argument}"
375+
local language="${1:?${FUNCNAME[0]} missing the language argument}"
376+
local test_suite="${2:?${FUNCNAME[0]} missing the test suite argument}"
377377

378378
case "${language}" in
379379
java | cpp | python)
@@ -472,7 +472,7 @@ psm::build::docker_images_if_needed() {
472472
# Writes the output of docker image build stdout, stderr
473473
#######################################
474474
psm::build::docker_images_generic() {
475-
local client_dockerfile="${1:?missing the client dockerfile argument}"
475+
local client_dockerfile="${1:?${FUNCNAME[0]} missing the client dockerfile argument}"
476476
local server_dockerfile="${2:-}"
477477
pushd "${SRC_DIR}"
478478

@@ -521,7 +521,7 @@ psm::tools::log() {
521521
}
522522

523523
psm::tools::print_test_flags() {
524-
local test_name="${1:?missing the test name argument}"
524+
local test_name="${1:?${FUNCNAME[0]} missing the test name argument}"
525525
psm::tools::log "Test driver flags for ${test_name}:"
526526
printf -- "%s\n" "${PSM_TEST_FLAGS[@]}"
527527
echo

0 commit comments

Comments
 (0)