Skip to content

Commit 02cc9d6

Browse files
authored
Monitoring: Fix environment variables for VPC tests. (googleapis#8302)
1 parent aabd98d commit 02cc9d6

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

monitoring/noxfile.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ def system(session):
122122
session.install("-e", ".")
123123

124124
# Additional setup for VPCSC system tests
125-
env = {
126-
"PROJECT_ID": "secure-gcp-test-project-4",
127-
"GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT": os.environ.get(
128-
"PROJECT_ID"
129-
),
130-
}
125+
if os.environ.get("GOOGLE_CLOUD_TESTS_IN_VPCSC") != "true":
126+
# Unset PROJECT_ID, since VPCSC system tests expect this to be a project
127+
# within the VPCSC perimeter.
128+
env = {
129+
"PROJECT_ID": "",
130+
"GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT": os.environ.get("PROJECT_ID"),
131+
}
131132

132133
# Run py.test against the system tests.
133134
if system_test_exists:

monitoring/tests/system/test_vpcsc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
from google.cloud.monitoring_v3 import enums
2929

3030
PROJECT_INSIDE = os.environ.get("PROJECT_ID", None)
31+
if not PROJECT_INSIDE:
32+
PROJECT_INSIDE = None
3133
PROJECT_OUTSIDE = os.environ.get(
3234
"GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT", None
3335
)

0 commit comments

Comments
 (0)