Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 6d0b427

Browse files
committed
chore: Adjusting the testing scripts in .kokoro/samples.
1 parent 48b5162 commit 6d0b427

File tree

4 files changed

+27
-33
lines changed

4 files changed

+27
-33
lines changed

.kokoro/samples/python3.6/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ action {
1010
# Specify which tests to run
1111
env_vars: {
1212
key: "RUN_TESTS_SESSION"
13-
value: "py-3.6"
13+
value: "samples-3.6"
1414
}
1515

1616
# Declare build specific Cloud project.

.kokoro/samples/python3.7/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ action {
1010
# Specify which tests to run
1111
env_vars: {
1212
key: "RUN_TESTS_SESSION"
13-
value: "py-3.7"
13+
value: "samples-3.7"
1414
}
1515

1616
# Declare build specific Cloud project.

.kokoro/samples/python3.8/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ action {
1010
# Specify which tests to run
1111
env_vars: {
1212
key: "RUN_TESTS_SESSION"
13-
value: "py-3.8"
13+
value: "samples-3.8"
1414
}
1515

1616
# Declare build specific Cloud project.

.kokoro/test-samples-impl.sh

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,32 @@ set +e
6464
# Use RTN to return a non-zero value if the test fails.
6565
RTN=0
6666
ROOT=$(pwd)
67-
# Find all requirements.txt in the samples directory (may break on whitespace).
68-
for file in samples/**/requirements.txt; do
69-
cd "$ROOT"
70-
# Navigate to the project folder.
71-
file=$(dirname "$file")
72-
cd "$file"
73-
74-
echo "------------------------------------------------------------"
75-
echo "- testing $file"
76-
echo "------------------------------------------------------------"
77-
78-
# Use nox to execute the tests for the project.
79-
python3.6 -m nox -s "$RUN_TESTS_SESSION"
80-
EXIT=$?
81-
82-
# If this is a periodic build, send the test log to the FlakyBot.
83-
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
84-
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
85-
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
86-
$KOKORO_GFILE_DIR/linux_amd64/flakybot
87-
fi
88-
89-
if [[ $EXIT -ne 0 ]]; then
90-
RTN=1
91-
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
92-
else
93-
echo -e "\n Testing completed.\n"
94-
fi
95-
96-
done
67+
9768
cd "$ROOT"
9869

70+
echo "------------------------------------------------------------"
71+
echo "- testing $file"
72+
echo "------------------------------------------------------------"
73+
74+
# Use nox to execute the tests for the project.
75+
python3.6 -m nox -s "$RUN_TESTS_SESSION"
76+
EXIT=$?
77+
78+
# If this is a periodic build, send the test log to the FlakyBot.
79+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
80+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
81+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
82+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
83+
fi
84+
85+
if [[ $EXIT -ne 0 ]]; then
86+
RTN=1
87+
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
88+
else
89+
echo -e "\n Testing completed.\n"
90+
fi
91+
92+
9993
# Workaround for Kokoro permissions issue: delete secrets
10094
rm testing/{test-env.sh,client-secrets.json,service-account.json}
10195

0 commit comments

Comments
 (0)