Skip to content

Commit c5eadab

Browse files
committed
tests: refactor system tests
1 parent de755c2 commit c5eadab

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

packages/google-auth/noxfile.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import os
1616
import pathlib
1717
import shutil
18-
import subprocess
1918

2019
import nox
2120

@@ -58,36 +57,6 @@
5857
]
5958

6059

61-
def _provision_kokoro_secrets():
62-
"""Downloads CI secrets directly from GCS and formats them for the tests."""
63-
if not os.environ.get("KOKORO_GFILE_DIR"):
64-
return
65-
66-
dest_dir = pathlib.Path(__file__).parent / "data"
67-
dest_dir.mkdir(parents=True, exist_ok=True)
68-
69-
# Map GCS filenames to the local filenames expected by tests
70-
secrets_map = {
71-
"google-auth-service-account.json": "service_account.json",
72-
"google-auth-authorized-user.json": "authorized_user.json",
73-
"google-auth-impersonated-service-account.json": "impersonated_service_account.json",
74-
}
75-
76-
gcs_base = "gs://cloud-devrel-kokoro-resources/google-cloud-python"
77-
78-
for src_name, dest_name in secrets_map.items():
79-
subprocess.run(
80-
["gcloud", "storage", "cp", f"{gcs_base}/{src_name}", str(dest_dir)],
81-
check=True,
82-
capture_output=True,
83-
)
84-
# Rename to use underscores as per test conventions
85-
(dest_dir / src_name).replace(dest_dir / dest_name)
86-
87-
88-
_provision_kokoro_secrets()
89-
90-
9160
@nox.session(python=DEFAULT_PYTHON_VERSION)
9261
def lint(session):
9362
session.install(

packages/google-auth/system_tests/noxfile.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,37 @@
6969
# The full path to the gcloud cli executable.
7070
GCLOUD = str(CLOUD_SDK_INSTALL_DIR.joinpath("bin", "gcloud"))
7171

72+
73+
def _provision_kokoro_secrets():
74+
"""Downloads CI secrets directly from GCS and formats them for the tests."""
75+
if not os.environ.get("KOKORO_GFILE_DIR"):
76+
return
77+
78+
dest_dir = pathlib.Path(__file__).parent / "data"
79+
dest_dir.mkdir(parents=True, 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(dest_dir)],
93+
check=True,
94+
capture_output=True,
95+
)
96+
# Rename to use underscores as per test conventions
97+
(dest_dir / src_name).replace(dest_dir / dest_name)
98+
99+
100+
_provision_kokoro_secrets()
101+
102+
72103
# Cloud SDK helpers
73104

74105

0 commit comments

Comments
 (0)