Skip to content
Permalink
Browse files
docs: adding backoff to quickstart test (#135)
* adding backoff to quickstart test

* fixing lint
  • Loading branch information
bradmiro committed Mar 2, 2021
1 parent 6231361 commit a22df4c0a15b2fa51cbe0f0cc2782def1a74c198
Showing with 12 additions and 1 deletion.
  1. +10 −1 samples/snippets/quickstart/quickstart_test.py
  2. +2 −0 samples/snippets/requirements.txt
@@ -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
@@ -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)

@@ -1,3 +1,5 @@

backoff==1.10.0
grpcio==1.36.0
google-auth==1.27.0
google-auth-httplib2==0.0.4

0 comments on commit a22df4c

Please sign in to comment.