Skip to content

Commit f4d45f2

Browse files
committed
test(asset): add sleep retries to prevent RESOURCE_EXHAUSTED quota errors
1 parent 7777583 commit f4d45f2

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

asset/snippets/test/asset.test.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,20 @@ describe('asset sample tests', () => {
106106

107107
it('should list assets successfully', async () => {
108108
const assetType = 'storage.googleapis.com/Bucket';
109-
const stdout = execSync(`node listAssets ${assetType} 'RESOURCE'`);
109+
let waitMs = 2000;
110+
let stdout = '';
111+
for (let retry = 0; retry < 3; retry++) {
112+
try {
113+
await sleep(waitMs);
114+
stdout = execSync(`node listAssets ${assetType} 'RESOURCE'`);
115+
break;
116+
} catch (err) {
117+
if (retry === 2) {
118+
throw err;
119+
}
120+
}
121+
waitMs *= 2;
122+
}
110123
assert.include(stdout, assetType);
111124
});
112125

0 commit comments

Comments
 (0)