Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for load jobs to complete in system tests. #3782

Merged
merged 3 commits into from
Aug 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from test_utils.system import unique_resource_id


JOB_TIMEOUT = 120 # 2 minutes
WHERE = os.path.abspath(os.path.dirname(__file__))


Expand Down Expand Up @@ -381,8 +382,7 @@ def test_load_table_from_local_file_then_dump_table(self):
)

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

self.assertEqual(job.output_rows, len(ROWS))

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

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

self.assertEqual(job.output_rows, len(ROWS))

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

# Retry until done.
retry = RetryInstanceState(_job_done, max_tries=8)
retry(job.reload)()
job.result(timeout=JOB_TIMEOUT)
self._fetch_single_page(table)

def test_sync_query_w_dml(self):
Expand Down Expand Up @@ -799,7 +797,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(unique_resource_id()))
self.assertEqual(Config.CURSOR.rowcount, 1)
self.assertIsNone(Config.CURSOR.fetchone())

Expand Down Expand Up @@ -1086,7 +1086,7 @@ def test_async_query_future(self):
str(uuid.uuid4()), 'SELECT 1')
query_job.use_legacy_sql = False

iterator = query_job.result().fetch_data()
iterator = query_job.result(timeout=JOB_TIMEOUT).fetch_data()
rows = list(iterator)
self.assertEqual(rows, [(1,)])

Expand Down