@@ -5414,9 +5414,14 @@ def test_query_job_rpc_fail_w_conflict_random_id_job_fetch_retries_404_and_query
54145414 creds = _make_credentials ()
54155415 http = object ()
54165416 client = self ._make_one (project = self .PROJECT , credentials = creds , _http = http )
5417+
5418+ # We're mocking QueryJob._begin, so that the connection should only get
5419+ # jobs.get requests.
5420+ job_create_error = google .api_core .exceptions .Conflict ("Job already exists." )
5421+ job_begin_patcher = mock .patch .object (
5422+ bqjob .QueryJob , "_begin" , side_effect = job_create_error
5423+ )
54175424 conn = client ._connection = make_connection (
5418- # We're mocking QueryJob._begin, so this is only going to be
5419- # jobs.get requests and responses.
54205425 google .api_core .exceptions .NotFound ("we lost your job again, sorry" ),
54215426 {
54225427 "jobReference" : {
@@ -5428,10 +5433,8 @@ def test_query_job_rpc_fail_w_conflict_random_id_job_fetch_retries_404_and_query
54285433 )
54295434
54305435 # Choose a small deadline so the 404 retries give up.
5431- retry = google .cloud .bigquery .retry .DEFAULT_RETRY .with_deadline (1 )
5432- job_create_error = google .api_core .exceptions .Conflict ("Job already exists." )
5433- job_begin_patcher = mock .patch .object (
5434- bqjob .QueryJob , "_begin" , side_effect = job_create_error
5436+ retry = (
5437+ google .cloud .bigquery .retry ._DEFAULT_GET_JOB_CONFLICT_RETRY .with_deadline (1 )
54355438 )
54365439 job_id_patcher = mock .patch .object (
54375440 google .cloud .bigquery ._job_helpers ,
@@ -5447,7 +5450,7 @@ def test_query_job_rpc_fail_w_conflict_random_id_job_fetch_retries_404_and_query
54475450 with freezegun .freeze_time (
54485451 "2025-01-01 00:00:00" ,
54495452 # 10x the retry deadline to guarantee a timeout.
5450- auto_tick_seconds = 100 ,
5453+ auto_tick_seconds = 10 ,
54515454 ), job_begin_patcher , job_id_patcher , retry_patcher :
54525455 # If get job request fails there does exist a job
54535456 # with this ID already, retry 404 until we get it (or fails for a
0 commit comments