Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
adding backoff to quickstart test
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmiro committed Feb 22, 2021
1 parent d81d7f1 commit 860b79e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion samples/snippets/quickstart/quickstart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import os
import uuid

import backoff
from google.api_core.exceptions import ServiceUnavailable
from google.cloud import dataproc_v1 as dataproc
from google.cloud import storage
import pytest
Expand All @@ -39,7 +41,14 @@
@pytest.fixture(autouse=True)
def setup_teardown():
storage_client = storage.Client()
bucket = storage_client.create_bucket(STAGING_BUCKET)

@backoff.on_exception(backoff.expo,
ServiceUnavailable,
max_tries=5)
def create_bucket():
return storage_client.create_bucket(STAGING_BUCKET)

bucket = create_bucket()
blob = bucket.blob(JOB_FILE_NAME)
blob.upload_from_string(SORT_CODE)

Expand Down
1 change: 1 addition & 0 deletions samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
backoff==1.10.0
grpcio==1.35.0
google-auth==1.27.0
google-auth-httplib2==0.0.4
Expand Down

0 comments on commit 860b79e

Please sign in to comment.