Skip to content

Commit 6e08d1f

Browse files
committed
tests: refactor system tests
1 parent 6bbd51d commit 6e08d1f

File tree

2 files changed

+6
-29
lines changed

2 files changed

+6
-29
lines changed

.kokoro/system.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ run_package_test() {
5151

5252
case "${package_name}" in
5353
"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+
5460
PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/google-auth-project-id.json")
5561
GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/google-auth-service-account.json"
5662
NOX_FILE="system_tests/noxfile.py"

packages/google-auth/system_tests/noxfile.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import os
2626
import pathlib
2727
import shutil
28-
import subprocess
2928
import tempfile
3029

3130
import nox
@@ -71,34 +70,6 @@
7170
GCLOUD = str(CLOUD_SDK_INSTALL_DIR.joinpath("bin", "gcloud"))
7271

7372

74-
def _provision_kokoro_secrets():
75-
"""Downloads CI secrets directly from GCS and formats them for the tests."""
76-
if not os.environ.get("KOKORO_GFILE_DIR"):
77-
return
78-
79-
os.makedirs(DATA_DIR, exist_ok=True)
80-
81-
# Map GCS filenames to the local filenames expected by tests
82-
secrets_map = {
83-
"google-auth-service-account.json": "service_account.json",
84-
"google-auth-authorized-user.json": "authorized_user.json",
85-
"google-auth-impersonated-service-account.json": "impersonated_service_account.json",
86-
}
87-
88-
gcs_base = "gs://cloud-devrel-kokoro-resources/google-cloud-python"
89-
90-
for src_name, dest_name in secrets_map.items():
91-
subprocess.run(
92-
["gcloud", "storage", "cp", f"{gcs_base}/{src_name}", str(DATA_DIR)],
93-
check=True,
94-
)
95-
# Rename to use underscores as per test conventions
96-
(pathlib.Path(DATA_DIR) / src_name).replace(pathlib.Path(DATA_DIR) / dest_name)
97-
98-
99-
_provision_kokoro_secrets()
100-
101-
10273
# Cloud SDK helpers
10374

10475

0 commit comments

Comments
 (0)