Skip to content

Commit

Permalink
chore: reduce the runtime of CLI unit tests by 2 minutes (#32988)
Browse files Browse the repository at this point in the history
There was a test that was waiting a minute for some operation to time out after 7 retries.

Make those retries happen faster by hijacking the timer system.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
rix0rrr authored Jan 20, 2025
1 parent e31924a commit c9d4a67
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,13 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
);

silentTest(
'updateFunction() API fails if it recieves 7 failed attempts in a row - this is a long running test',
'updateFunction() API fails if it recieves 7 failed attempts in a row',
async () => {
// Ignore the wait times that the SDK tries to impose and always set timers for 1 ms
const realSetTimeout = setTimeout;
const mockSetTimeout = jest.spyOn(global, 'setTimeout').mockImplementation((fn) => {
return realSetTimeout(fn, 1);
});

// GIVEN
mockAppSyncClient
Expand Down Expand Up @@ -1123,6 +1128,8 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot
requestMappingTemplate: '## original request template',
responseMappingTemplate: '## new response template',
});

mockSetTimeout.mockRestore();
},
320000,
);
Expand Down

0 comments on commit c9d4a67

Please sign in to comment.