-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: automlIssues related to the AutoML API.Issues related to the AutoML API.api: cloudassetIssues related to the Cloud Asset Inventory API.Issues related to the Cloud Asset Inventory API.api: cloudtraceIssues related to the Cloud Trace API.Issues related to the Cloud Trace API.api: dlpIssues related to the Sensitive Data Protection API.Issues related to the Sensitive Data Protection API.api: monitoringIssues related to the Cloud Monitoring API.Issues related to the Cloud Monitoring API.api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.api: translationIssues related to the Cloud Translation API API.Issues related to the Cloud Translation API API.api: videointelligenceIssues related to the Video Intelligence API API.Issues related to the Video Intelligence API API.api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.testingtype: processA process-related concern. May include testing, release, or the like.A process-related concern. May include testing, release, or the like.
Description
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:
- Never set the environment variables in
noxfile.py. - If the inside / outside project variables are missing, skip the affected testcases cleanly.
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:
from test_utils.vpcsc_config import vpcsc_config
@vpcsc_config.skip_unless_inside_project
def test_requiring_inside_project():
do_something_with(vpcsc_config.project_inside)
@vpcsc_config.skip_unless_outside_project
def test_requiring_outside_project():
do_something_with(vpcsc_config.project_outside)
@vpcsc_config.skip_unless_outside_bucket
def test_requiring_outside_bucket():
do_something_with(vpcsc_config.bucket_outside)
@vpcsc_config.skip_unless_inside_project
@vpcsc_config.skip_unless_outside_project
def test_requiring_inside_and_outside_projects():
if vpcsc_config.inside_vpcsc:
do_something_with(vpcsc_config.project_inside, vpcsc_config.project_outside)
@vpcsc_config.skip_if_inside_vpcsc
def test_incompatible_with_vpcsc():
...
@vpcsc_config.skip_unless_inside_vpcsc
def test_requiring_requires_vpcsc():
...Steps:
- Add 'test_utils/test_utils/vpcsc_config.py`, with the indicated 'VPCSCConfig' class and singleton (tests: add centralized VPCSC config detection #9581)
- Apply in
asset/tests/system/test_vpcsc.py.(tests(asset): normalize VPCSC configuration in systests #9614) - Apply in
automl/tests/system/gapic/v1beta1/test_system_tables_client_v1.py. (tests(automl): normalize VPCSC configuration in systests #9607) - Apply in
dlp/tests/system/gapic/v2/test_system_dlp_service_v2_vpcsc.py. (tests(dlp): normalize VPCSC configuration in systests #9608) - Apply in
monitoring/tests/system/test_vpcsc_v3.py. (tests(monitoring): normalize VPCSC configuration in systests #9615) - Apply in
storage/tests/system.py. (tests(storage): normalize VPCSC configuration in systests. #9616) - Apply in
trace/tests/system/gapic/v{1,3}/test_system_trace_service_v{1,2}_vpcsc.py. (tests(trace): normalize VPCSC configuration in systests #9618) - Appy lin
translate/tests/system/test_vpcsc.py. (tests(translate): normalize VPCSC configuration in systests #9619) - Appy lin
videointelligence/tests/system.py. (tests(videointelligence): normalize VPCSC configuration in systests #9776) - Appy lin
vision/tests/system.py. (tests(vision): normalize VPCSC configuration in systests #9620)
Metadata
Metadata
Assignees
Labels
api: automlIssues related to the AutoML API.Issues related to the AutoML API.api: cloudassetIssues related to the Cloud Asset Inventory API.Issues related to the Cloud Asset Inventory API.api: cloudtraceIssues related to the Cloud Trace API.Issues related to the Cloud Trace API.api: dlpIssues related to the Sensitive Data Protection API.Issues related to the Sensitive Data Protection API.api: monitoringIssues related to the Cloud Monitoring API.Issues related to the Cloud Monitoring API.api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.api: translationIssues related to the Cloud Translation API API.Issues related to the Cloud Translation API API.api: videointelligenceIssues related to the Video Intelligence API API.Issues related to the Video Intelligence API API.api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.testingtype: processA process-related concern. May include testing, release, or the like.A process-related concern. May include testing, release, or the like.