Skip to content

Commit d488e00

Browse files
authored
Merge branch 'main' into migration.python-pubsub.migration.2026-03-02_16-59-45.migrate
2 parents b267d9c + afa0faa commit d488e00

File tree

1,166 files changed

+489162
-7481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,166 files changed

+489162
-7481
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ coverage.xml
5757
*sponge_log.xml
5858

5959
# System test environment variables.
60-
system_tests/local_test_setup
60+
**/system_tests/local_test_setup
61+
**/system_tests/data
6162

6263
# Make sure a generated file isn't accidentally committed.
6364
pylintrc

.kokoro/system-single.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ pwd
2222

2323
# If NOX_SESSION is set, it only runs the specified session,
2424
# otherwise run all the sessions.
25-
SESSION_ARG=""
25+
NOX_SESSION_ARG=""
2626

27-
[[ -z "${NOX_SESSION}" ]] || SESSION_ARG="-s ${NOX_SESSION}"
28-
python3 -m nox ${SESSION_ARG}
27+
# IF NOX_FILE is set, it runs the specific nox file,
28+
# otherwise it runs noxfile.py in the package directory.
29+
NOX_FILE_ARG=""
30+
31+
[[ -z "${NOX_SESSION}" ]] || NOX_SESSION_ARG="-s ${NOX_SESSION}"
32+
33+
[[ -z "${NOX_FILE}" ]] || NOX_FILE_ARG="-f ${NOX_FILE}"
34+
35+
python3 -m nox ${NOX_SESSION_ARG} $NOX_FILE_ARG

.kokoro/system.sh

Lines changed: 68 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,69 @@ export PYTHONUNBUFFERED=1
2424
# Setup firestore account credentials
2525
export FIRESTORE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/firebase-credentials.json
2626

27-
# Setup service account credentials.
28-
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
29-
30-
# Setup project id.
31-
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
32-
33-
RETVAL=0
34-
3527
export PROJECT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)
3628

3729
cd "$PROJECT_ROOT"
3830

39-
pwd
40-
41-
# A file for running system tests
42-
system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
43-
4431
# This is needed in order for `git diff` to succeed
4532
git config --global --add safe.directory $(realpath .)
4633

34+
RETVAL=0
35+
36+
pwd
37+
38+
run_package_test() {
39+
local package_name=$1
40+
local package_path="packages/${package_name}"
41+
42+
# Declare local overrides to prevent bleeding into the next loop iteration
43+
local PROJECT_ID
44+
local GOOGLE_APPLICATION_CREDENTIALS
45+
local NOX_FILE
46+
local NOX_SESSION
47+
48+
echo "------------------------------------------------------------"
49+
echo "Configuring environment for: ${package_name}"
50+
echo "------------------------------------------------------------"
51+
52+
case "${package_name}" in
53+
"google-auth")
54+
# Copy files needed for google-auth system tests
55+
mkdir -p "${package_path}/system_tests/data"
56+
cp "${KOKORO_GFILE_DIR}/google-auth-service-account.json" "${package_path}/system_tests/data/service_account.json"
57+
cp "${KOKORO_GFILE_DIR}/google-auth-authorized-user.json" "${package_path}/system_tests/data/authorized_user.json"
58+
cp "${KOKORO_GFILE_DIR}/google-auth-impersonated-service-account.json" "${package_path}/system_tests/data/impersonated_service_account.json"
59+
60+
PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/google-auth-project-id.json")
61+
GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/google-auth-service-account.json"
62+
NOX_FILE="system_tests/noxfile.py"
63+
NOX_SESSION=""
64+
;;
65+
*)
66+
PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
67+
GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/service-account.json"
68+
NOX_FILE="noxfile.py"
69+
NOX_SESSION="system-3.12"
70+
;;
71+
esac
72+
73+
# Export variables for the duration of this function's sub-processes
74+
export PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS NOX_FILE NOX_SESSION
75+
76+
gcloud auth activate-service-account --key-file="$GOOGLE_APPLICATION_CREDENTIALS"
77+
gcloud config set project "$PROJECT_ID"
78+
79+
# Run the actual test
80+
pushd "${package_path}" > /dev/null
81+
set +e
82+
"${system_test_script}"
83+
local res=$?
84+
set -e
85+
popd > /dev/null
86+
87+
return $res
88+
}
89+
4790
packages_with_system_tests=(
4891
"google-auth"
4992
"google-cloud-bigquery-storage"
@@ -57,11 +100,13 @@ packages_with_system_tests=(
57100
"google-cloud-testutils"
58101
)
59102

103+
# A file for running system tests
104+
system_test_script="${PROJECT_ROOT}/.kokoro/system-single.sh"
105+
60106
# Join array elements with | for the pattern match
61107
packages_with_system_tests_pattern=$(printf "|*%s*" "${packages_with_system_tests[@]}")
62108
packages_with_system_tests_pattern="${packages_with_system_tests_pattern:1}" # Remove the leading pipe
63109

64-
65110
# Run system tests for each package with directory packages/*/tests/system
66111
for path in `find 'packages' \
67112
\( -type d -wholename 'packages/*/tests/system' \) -o \
@@ -75,32 +120,22 @@ for path in `find 'packages' \
75120
package_name=${package_name%%/*}
76121
package_path="packages/${package_name}"
77122

78-
# Run system tests on every change to these libraries
79-
if [[ $package == @($packages_with_system_tests_pattern) ]]; then
80-
files_to_check=${package}
81-
else
82-
files_to_check=${package}/CHANGELOG.md
123+
# Determine if we should skip based on git diff
124+
files_to_check="${package_path}/CHANGELOG.md"
125+
if [[ $package_name == @($packages_with_system_tests_pattern) ]]; then
126+
files_to_check="${package_path}"
83127
fi
84128

85129
echo "checking changes with 'git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check}'"
86130
set +e
87131
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check} | wc -l)
88132
set -e
89-
if [[ "${package_modified}" -eq 0 ]]; then
90-
echo "no change detected in ${files_to_check}, skipping"
133+
134+
if [[ "${package_modified}" -gt 0 ]]; then
135+
# Call the function - its internal exports won't affect the next loop
136+
run_package_test "$package_name" || RETVAL=$?
91137
else
92-
echo "change detected in ${files_to_check}"
93-
echo "Running system tests for ${package}"
94-
pushd ${package}
95-
# Temporarily allow failure.
96-
set +e
97-
${system_test_script}
98-
ret=$?
99-
set -e
100-
if [ ${ret} -ne 0 ]; then
101-
RETVAL=${ret}
102-
fi
103-
popd
138+
echo "No changes in ${package_name}, skipping."
104139
fi
105140
done
106141
exit ${RETVAL}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"api_description": "The Cluster Director API allows you to deploy, manage, and monitor clusters that run AI, ML, or HPC workloads.",
3+
"api_id": "hypercomputecluster.googleapis.com",
4+
"api_shortname": "hypercomputecluster",
5+
"client_documentation": "https://cloud.google.com/python/docs/reference/google-cloud-hypercomputecluster/latest",
6+
"default_version": "v1",
7+
"distribution_name": "google-cloud-hypercomputecluster",
8+
"issue_tracker": "https://issuetracker.google.com/issues/new?component=1907878&template=2195617",
9+
"language": "python",
10+
"library_type": "GAPIC_AUTO",
11+
"name": "google-cloud-hypercomputecluster",
12+
"name_pretty": "Cluster Director API",
13+
"product_documentation": "https://cloud.google.com/blog/products/compute/managed-slurm-and-other-cluster-director-enhancements",
14+
"release_level": "preview",
15+
"repo": "googleapis/google-cloud-python"
16+
}

0 commit comments

Comments
 (0)