Skip to content

Commit ff0d2dc

Browse files
author
Takashi Matsuo
authored
testing(sample): fix broken tests (#108)
* testing(sample): fix broken tests fixes #104 fixes #105 * explicitly specify the project id on bucket creation longer timeout
1 parent 2a604d2 commit ff0d2dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/google-cloud-asset/samples/snippets/quickstart_batchgetassetshistory_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131
@pytest.fixture(scope="module")
3232
def storage_client():
33-
yield storage.Client()
33+
yield storage.Client(project=PROJECT)
3434

3535

3636
@pytest.fixture(scope="module")
3737
def asset_bucket(storage_client):
38-
bucket = storage_client.create_bucket(BUCKET)
38+
bucket = storage_client.create_bucket(BUCKET, project=PROJECT)
3939

4040
yield BUCKET
4141

@@ -52,7 +52,7 @@ def test_batch_get_assets_history(asset_bucket, capsys):
5252
bucket_asset_name,
5353
]
5454

55-
@backoff.on_exception(backoff.expo, (AssertionError, InvalidArgument), max_time=30)
55+
@backoff.on_exception(backoff.expo, (AssertionError, InvalidArgument), max_time=60)
5656
def eventually_consistent_test():
5757
quickstart_batchgetassetshistory.batch_get_assets_history(PROJECT, asset_names)
5858
out, _ = capsys.readouterr()

packages/google-cloud-asset/samples/snippets/quickstart_searchallresources_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_search_all_resources(asset_dataset, capsys):
5353

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

0 commit comments

Comments
 (0)