Skip to content

Commit 40ddb69

Browse files
authored
test: enable BYOSA test for remote_function cloud function (#432)
This support was added in [PR#407](https://togithub.com/googleapis/python-bigquery-dataframes/pull/407) but the test was only verified locally since the project `bigframes-load-testing` is latchkey managed and would require some extra configuration to set-up. This change does one step better by enabling the test in the automated pipelines by targeting it to a different project `bigframes-dev-perf` which is easier to set up through cloud console. Eventually it should be moved to run entirely in `bigframes-load-testing` after the necessary configuration is done through latchkey (created internal issue 329339908 to track the work). Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent 1c3e668 commit 40ddb69

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

tests/system/large/test_remote_function.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -1281,19 +1281,29 @@ def square(x):
12811281
)
12821282

12831283

1284-
@pytest.mark.skip("This requires additional project config.")
1284+
@pytest.mark.flaky(retries=2, delay=120)
12851285
def test_remote_function_via_session_custom_sa(scalars_dfs):
1286-
# Set these values to run the test locally
1287-
# TODO(shobs): Automate and enable this test
1288-
PROJECT = ""
1289-
GCF_SERVICE_ACCOUNT = ""
1286+
# TODO(shobs): Automate the following set-up during testing in the test project.
1287+
#
1288+
# For upfront convenience, the following set up has been statically created
1289+
# in the project bigfrmames-dev-perf via cloud console:
1290+
#
1291+
# 1. Create a service account as per
1292+
# https://cloud.google.com/iam/docs/service-accounts-create#iam-service-accounts-create-console
1293+
# 2. Give necessary roles as per
1294+
# https://cloud.google.com/functions/docs/reference/iam/roles#additional-configuration
1295+
#
1296+
project = "bigframes-dev-perf"
1297+
gcf_service_account = (
1298+
1299+
)
12901300

1291-
rf_session = bigframes.Session(context=bigframes.BigQueryOptions(project=PROJECT))
1301+
rf_session = bigframes.Session(context=bigframes.BigQueryOptions(project=project))
12921302

12931303
try:
12941304

12951305
@rf_session.remote_function(
1296-
[int], int, reuse=False, cloud_function_service_account=GCF_SERVICE_ACCOUNT
1306+
[int], int, reuse=False, cloud_function_service_account=gcf_service_account
12971307
)
12981308
def square_num(x):
12991309
if x is None:
@@ -1316,7 +1326,7 @@ def square_num(x):
13161326
gcf = rf_session.cloudfunctionsclient.get_function(
13171327
name=square_num.bigframes_cloud_function
13181328
)
1319-
assert gcf.service_config.service_account_email == GCF_SERVICE_ACCOUNT
1329+
assert gcf.service_config.service_account_email == gcf_service_account
13201330
finally:
13211331
# clean up the gcp assets created for the remote function
13221332
cleanup_remote_function_assets(

0 commit comments

Comments
 (0)