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 <bencoe@google.com>
Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 2, 2021
1 parent 0d0efbd commit fb0daa0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions asset/snippets/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 fb0daa0

Please sign in to comment.