apache / apache/beam

[Bug]: Bigquery exception handling unit tests invoke real credential

Open
#22,109 0 comments 0 reactions 1 assignee Claimed by @johnjcasey View on GitHub
bug gcp io P2 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
205

Description

### What happened?

Running bigquery unit test locally (est_create_temp_dataset_exception, test_query_job_exception, test_read_export_exception, test_copy_load_job_exception, test_load_job_exception) surprisingly pops up google cloud authentication page in web browser.
Taking a close look, the test uses real gcp_client and querying for default project. If the command line environment does not have a gcloud auth configured, it will popup a webpage asking login into google account. Closing this page, the test get stuck and the webpage gets popup again after some time, likely running into a retry logic.

The unit test should neither depend on nor validate real credential.

```
apache_beam/io/iobase.py:1638: in split
for source_bundle in source_bundles:
apache_beam/io/gcp/bigquery.py:830: in split
bq = bigquery_tools.BigQueryWrapper(
apache_beam/io/gcp/bigquery_tools.py:336: in __init__
self.gcp_bq_client = client or gcp_bigquery.Client(
../../../dev/virtualenv/py38beam/lib/python3.8/site-packages/google/cloud/bigquery/client.py:231: in __init__
super(Client, self).__init__(
../../../dev/virtualenv/py38beam/lib/python3.8/site-packages/google/cloud/client.py:318: in __init__
```

### Issue Priority

Priority: 2

### Issue Component

Component: io-py-gcp

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.