Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
testing(sample): fix broken tests (#108)
Browse files Browse the repository at this point in the history
* testing(sample): fix broken tests

fixes #104
fixes #105

* explicitly specify the project id on bucket creation

longer timeout
  • Loading branch information
Takashi Matsuo authored Nov 12, 2020
1 parent b112f29 commit 9345891
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions samples/snippets/quickstart_batchgetassetshistory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

@pytest.fixture(scope="module")
def storage_client():
yield storage.Client()
yield storage.Client(project=PROJECT)


@pytest.fixture(scope="module")
def asset_bucket(storage_client):
bucket = storage_client.create_bucket(BUCKET)
bucket = storage_client.create_bucket(BUCKET, project=PROJECT)

yield BUCKET

Expand All @@ -52,7 +52,7 @@ def test_batch_get_assets_history(asset_bucket, capsys):
bucket_asset_name,
]

@backoff.on_exception(backoff.expo, (AssertionError, InvalidArgument), max_time=30)
@backoff.on_exception(backoff.expo, (AssertionError, InvalidArgument), max_time=60)
def eventually_consistent_test():
quickstart_batchgetassetshistory.batch_get_assets_history(PROJECT, asset_names)
out, _ = capsys.readouterr()
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/quickstart_searchallresources_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_search_all_resources(asset_dataset, capsys):

# Dataset creation takes some time to propagate, so the dataset is not
# immediately searchable. Need some time before the snippet will pass.
@backoff.on_exception(backoff.expo, (AssertionError), max_time=120)
@backoff.on_exception(backoff.expo, (AssertionError), max_time=240)
def eventually_consistent_test():
quickstart_searchallresources.search_all_resources(scope, query=query)
out, _ = capsys.readouterr()
Expand Down

0 comments on commit 9345891

Please sign in to comment.