Skip to content

Commit 025a487

Browse files
tests: remove hardcoded packages in system.sh (#17301)
This PR removes the hardcoded list of packages in `.kokoro/system.sh` , to determine whether system tests should run, which is error prone. For example, `google-cloud-bigquery` was missing from the list so system tests would only run in release PRs. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent ad3b8fa commit 025a487

1 file changed

Lines changed: 14 additions & 28 deletions

File tree

.kokoro/system.sh

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,9 @@ run_package_test() {
9090
return $res
9191
}
9292

93-
packages_with_system_tests=(
94-
"bigframes"
95-
"google-auth"
96-
"google-cloud-bigquery-storage"
97-
"google-cloud-bigtable"
98-
"google-cloud-compute"
99-
"google-cloud-compute-v1beta"
100-
"google-cloud-datastore"
101-
"google-cloud-dns"
102-
"google-cloud-error-reporting"
103-
"google-cloud-firestore"
104-
"google-cloud-logging"
105-
"google-cloud-ndb"
106-
"google-cloud-pubsub"
107-
"google-cloud-spanner"
108-
"google-cloud-storage"
109-
"google-cloud-testutils"
110-
"pandas-gbq"
111-
"sqlalchemy-bigquery"
112-
"sqlalchemy-spanner"
113-
)
114-
11593
# A file for running system tests
11694
system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
11795

118-
# Join array elements with | for the pattern match
119-
packages_with_system_tests_pattern=$(printf "|*%s*" "${packages_with_system_tests[@]}")
120-
packages_with_system_tests_pattern="${packages_with_system_tests_pattern:1}" # Remove the leading pipe
121-
12296
# Run system tests for each package with directory packages/*/tests/system
12397
for path in `find 'packages' \
12498
\( -type d -wholename 'packages/*/tests/system' \) -o \
@@ -142,8 +116,20 @@ for path in `find 'packages' \
142116
"${package_path}/**/version.py"
143117
)
144118

145-
# If the package is in our "always run full system tests" list, check the whole directory
146-
if [[ $package_name == @($packages_with_system_tests_pattern) ]]; then
119+
# Hand-written (non-GAPIC_AUTO) packages or google-cloud-compute should check
120+
# the whole directory for changes.
121+
metadata="${package_path}/.repo-metadata.json"
122+
library_type="UNKNOWN"
123+
if [ -f "$metadata" ]; then
124+
library_type=$(sed -n 's/.*"library_type":[[:space:]]*"\([^"]*\)".*/\1/p' "$metadata")
125+
library_type="${library_type:-UNKNOWN}"
126+
fi
127+
128+
# System tests always run in release PRs, regardless of library type.
129+
# Automated GAPIC libraries bypass system tests in non-release PRs because their generation is deterministic.
130+
# However, google-cloud-compute is included because its Discovery-based nature requires additional
131+
# verification.
132+
if [[ "${library_type}" != "GAPIC_AUTO" || "${package_name}" == "google-cloud-compute"* ]]; then
147133
files_to_check=("${package_path}")
148134
fi
149135

0 commit comments

Comments
 (0)