Skip to content

Commit fb0daa0

Browse files
peter-zheng-gbcoesofisl
authored
build: make quickstart sample tests more stable (#547)
* 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]>
1 parent 0d0efbd commit fb0daa0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

asset/snippets/test/sample.test.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ describe('quickstart sample tests', () => {
7979
// the newly created bucket:
8080
it('should get assets history successfully', async () => {
8181
const assetName = `//storage.googleapis.com/${bucketName}`;
82-
const stdout = execSync(`node getBatchAssetHistory ${assetName}`);
83-
assert.include(stdout, assetName);
82+
let waitMs = 1000;
83+
let included = false;
84+
for (let retry = 0; retry < 3 && !included; ++retry) {
85+
await sleep((waitMs *= 2));
86+
const stdout = execSync(`node getBatchAssetHistory ${assetName}`);
87+
included = stdout.includes(assetName);
88+
}
89+
assert.ok(included);
8490
});
8591

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

0 commit comments

Comments
 (0)