From cdc063b1be5762c86f96a5d6a6eaf222cf7af229 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 25 Jul 2019 11:29:43 -0700 Subject: [PATCH 1/2] Use configurable bucket name for GCS samples data in systems tests. This allows the VPC-SC team to use their private mirror which is within the security boundary when testing BigQuery VPC-SC support. --- bigquery/tests/system.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bigquery/tests/system.py b/bigquery/tests/system.py index f234a431d51f..1e590a260a8a 100644 --- a/bigquery/tests/system.py +++ b/bigquery/tests/system.py @@ -107,6 +107,11 @@ ), ] +# The VPC-SC team maintains a mirror of the GCS bucket used for code +# samples. The public bucket crosses the configured security boundary. +# See: https://github.com/googleapis/google-cloud-python/issues/8550 +SAMPLES_BUCKET = os.environ.get("GCLOUD_TEST_SAMPLES_BUCKET", "cloud-samples-data") + retry_storage_errors = RetryErrors( (TooManyRequests, InternalServerError, ServiceUnavailable) ) @@ -1877,7 +1882,7 @@ def test_create_routine(self): language="JAVASCRIPT", type_="SCALAR_FUNCTION", return_type=float64_type, - imported_libraries=["gs://cloud-samples-data/bigquery/udfs/max-value.js"], + imported_libraries=["gs://{}/bigquery/udfs/max-value.js".format(SAMPLES_BUCKET)], ) routine.arguments = [ bigquery.RoutineArgument( From cb46cdf8017d487176642c565ed25b34a5d82930 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 26 Jul 2019 16:07:39 -0700 Subject: [PATCH 2/2] Blacken --- bigquery/tests/system.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bigquery/tests/system.py b/bigquery/tests/system.py index 1e590a260a8a..fd9efa7752cf 100644 --- a/bigquery/tests/system.py +++ b/bigquery/tests/system.py @@ -1882,7 +1882,9 @@ def test_create_routine(self): language="JAVASCRIPT", type_="SCALAR_FUNCTION", return_type=float64_type, - imported_libraries=["gs://{}/bigquery/udfs/max-value.js".format(SAMPLES_BUCKET)], + imported_libraries=[ + "gs://{}/bigquery/udfs/max-value.js".format(SAMPLES_BUCKET) + ], ) routine.arguments = [ bigquery.RoutineArgument(