Skip to content

Commit 55f6e2c

Browse files
feat(Spanner): run backup tests only when requested explicitly (GoogleCloudPlatform#1691)
1 parent 804e524 commit 55f6e2c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

spanner/test/spannerBackupTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public static function setUpBeforeClass(): void
7272
if (!extension_loaded('grpc')) {
7373
self::markTestSkipped('Must enable grpc extension.');
7474
}
75+
if ('true' !== getenv('GOOGLE_SPANNER_RUN_BACKUP_TESTS')) {
76+
self::markTestSkipped('Skipping backup tests.');
77+
}
7578
self::$instanceId = self::requireEnv('GOOGLE_SPANNER_INSTANCE_ID');
7679

7780
$spanner = new SpannerClient([

testing/run_test_suite.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,21 @@ FILES_CHANGED=$(git diff --name-only HEAD $(git merge-base HEAD master))
8585
if [ -z "$PULL_REQUEST_NUMBER" ]; then
8686
RUN_ALL_TESTS=1
8787
else
88+
labels=$(curl "https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/$PULL_REQUEST_NUMBER/labels")
89+
8890
# Check to see if the repo includes the "kokoro:run-all" label
89-
if curl "https://api.github.com/repos/GoogleCloudPlatform/php-docs-samples/issues/$PULL_REQUEST_NUMBER/labels" \
90-
| grep -q "kokoro:run-all"; then
91+
if grep -q "kokoro:run-all" <<< $labels; then
9192
RUN_ALL_TESTS=1
9293
else
9394
RUN_ALL_TESTS=0
9495
fi
9596

97+
# Check to see if the repo includes the "spanner:run-backup-tests" label
98+
# If we intend to run the backup tests in Spanner, we set the env variable
99+
if grep -q "spanner:run-backup-tests" <<< $labels; then
100+
export GOOGLE_SPANNER_RUN_BACKUP_TESTS=true
101+
fi
102+
96103
fi
97104

98105
if [ "${TEST_DIRECTORIES}" = "" ]; then

0 commit comments

Comments
 (0)