Skip to content

Commit

Permalink
build: make quickstart sample tests more stable (#547)
Browse files Browse the repository at this point in the history
* CloudAsset: Update asset lib to v1 for ListAssets sample code

* CloudAsset: Fix flakiness of test of BatchGetAssetsHistory sample code

* CloudAsset: Remove unneeded output line in sample test

Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: sofisl <[email protected]>
  • Loading branch information
3 people authored Sep 2, 2021
1 parent 69a802f commit 786791c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/google-cloud-asset/samples/test/sample.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ describe('quickstart sample tests', () => {
// the newly created bucket:
it('should get assets history successfully', async () => {
const assetName = `//storage.googleapis.com/${bucketName}`;
const stdout = execSync(`node getBatchAssetHistory ${assetName}`);
assert.include(stdout, assetName);
let waitMs = 1000;
let included = false;
for (let retry = 0; retry < 3 && !included; ++retry) {
await sleep((waitMs *= 2));
const stdout = execSync(`node getBatchAssetHistory ${assetName}`);
included = stdout.includes(assetName);
}
assert.ok(included);
});

it('should run the quickstart', async () => {
Expand Down

0 comments on commit 786791c

Please sign in to comment.