Skip to content

Commit

Permalink
BQ: wait for load jobs to complete in system tests.
Browse files Browse the repository at this point in the history
Specify job ID in BQ DB-API DML tests to allow for further test flake
debugging.
  • Loading branch information
tswast committed Aug 9, 2017
1 parent 5b4b8fa commit 69a7849
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def test_load_table_from_local_file_then_dump_table(self):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()

Expand Down Expand Up @@ -419,6 +420,7 @@ def test_load_table_from_local_avro_file_then_dump_table(self):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()

Expand Down Expand Up @@ -770,6 +772,7 @@ def _load_table_for_dml(self, rows, dataset_name, table_name):
)

# Retry until done.
job.result()
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()
self._fetch_single_page(table)
Expand Down Expand Up @@ -799,7 +802,9 @@ def test_dbapi_w_dml(self):
WHERE greeting = 'Hello World'
"""

Config.CURSOR.execute(query_template.format(dataset_name, table_name))
Config.CURSOR.execute(
query_template.format(dataset_name, table_name),
job_id='test_dbapi_w_dml_{}'.format(str(uuid.uuid4())))
self.assertEqual(Config.CURSOR.rowcount, 1)
self.assertIsNone(Config.CURSOR.fetchone())

Expand Down

0 comments on commit 69a7849

Please sign in to comment.