-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing: rationalize / normalize VPCSC environment detection in systests #9580
Comments
Ugh, I've just found out that different test suites differ as to how the
|
👋 Ack, that is definitely a mess. I wrote up this doc to clarify with VPCSC and backend folks as to what they need. Tests should run only when the environment variable We can get rid of env var setup in the noxfile and run the tests depending on import os
IS_INSIDE_VPCSC = "GOOGLE_CLOUD_TESTS_IN_VPCSC" in os.environ
# If IS_INSIDE_VPCSC is set, these environment variables should also be set
if IS_INSIDE_VPCSC:
PROJECT_INSIDE = os.environ["PROJECT_ID"]
PROJECT_OUTSIDE = os.environ["GOOGLE_CLOUD_TESTS_VPCSC_OUTSIDE_PERIMETER_PROJECT"]
# Bucket, other resources if necessary @pytest.mark.skipif(
not IS_INSIDE_VPCSC,
reason="This test must be run in VPCSC. To enable this test, set the environment variable GOOGLE_CLOUD_TESTS_IN_VPCSC to True",
)
def test_create_alert_policy(self):
# …
# …
|
Thanks for working towards this @tseaver. As @busunkim96 said, this is a bit of a mess right now, but I think the approach you are taking makes sense. Do you have sufficient information to move forward on this work? Also, in the PRs I see edits to noxfiles. Would it make sense to make those edits, at least eventually, in https://github.com/googleapis/synthtool/blob/master/synthtool/gcp/templates/python_library/noxfile.py.j2 ? |
@crwilcox I intend to add one PR per API which currently has any VPCSC-specific tests, and will remove any VPCSC-specific envvar-setting in those PRs. Trying to get the noxfiles back to "pristine / as generated" is outside the scope of this issue. |
The last PR for this issue is now open in the new |
We need a clear pattern for how to test whether the appropriate environment variables are set for VPCSC, and ways to skip tests when they are missing. I believe the constraints should be:
noxfile.py
.I'm proposing to create a new module,
test_utils/test_utils/vpcsc_config.py
, which centralizes all this policy. Usage from systests would look like:Steps:
asset/tests/system/test_vpcsc.py
.(tests(asset): normalize VPCSC configuration in systests #9614)automl/tests/system/gapic/v1beta1/test_system_tables_client_v1.py
. (tests(automl): normalize VPCSC configuration in systests #9607)dlp/tests/system/gapic/v2/test_system_dlp_service_v2_vpcsc.py
. (tests(dlp): normalize VPCSC configuration in systests #9608)monitoring/tests/system/test_vpcsc_v3.py
. (tests(monitoring): normalize VPCSC configuration in systests #9615)storage/tests/system.py
. (tests(storage): normalize VPCSC configuration in systests. #9616)trace/tests/system/gapic/v{1,3}/test_system_trace_service_v{1,2}_vpcsc.py
. (tests(trace): normalize VPCSC configuration in systests #9618)translate/tests/system/test_vpcsc.py
. (tests(translate): normalize VPCSC configuration in systests #9619)videointelligence/tests/system.py
. (tests(videointelligence): normalize VPCSC configuration in systests #9776)vision/tests/system.py
. (tests(vision): normalize VPCSC configuration in systests #9620)The text was updated successfully, but these errors were encountered: