Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
fix: integ test setup flakiness fix (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
SanketD92 authored Sep 29, 2021
1 parent 04bb82c commit 65ea43d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main/integration-tests/support/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

const _ = require('lodash');
const jwtDecode = require('jwt-decode');
const { retry } = require('@aws-ee/base-services/lib/helpers/utils');

const Settings = require('./utils/settings');
const { getIdToken } = require('./utils/id-token');
Expand Down Expand Up @@ -261,10 +262,17 @@ class Setup {
* Use this function to gain access to a setup instance that is initialized and ready to be used.
*/
async function runSetup() {
const setupInstance = new Setup();
await setupInstance.init();
const tryCreateSetup = async () => {
const setupInstance = new Setup();
await setupInstance.init();

return setupInstance;
if (!setupInstance) throw Error('Setup instance did not initialize');
return setupInstance;
};

// Retry 3 times using an exponential interval
const setup = await retry(tryCreateSetup, 3);
return setup;
}

module.exports = { runSetup };

0 comments on commit 65ea43d

Please sign in to comment.