You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
awaitclock.tickAsync(1000);// Advance past the first delay (500 * 2^1)
851
+
852
+
awaitpromise;// Wait for the function to complete
853
+
854
+
expect(requestStub.calledTwice).to.be.true;
855
+
expect(serverless._logMessages).to.include('[serverless-api-gateway-caching] Updating API Gateway cache settings. Attempt 1.');
856
+
expect(serverless._logMessages).to.include('[serverless-api-gateway-caching] Retrying (1/10) after 1000ms due to error: A previous change is still in progress');
857
+
expect(serverless._logMessages).to.include('[serverless-api-gateway-caching] Updating API Gateway cache settings. Attempt 2.');
858
+
});
859
+
860
+
it('should fail after max retries on persistent ConflictException',async()=>{
861
+
constconflictError=newError('A previous change is still in progress');
862
+
conflictError.code='ConflictException';
863
+
constmaxRetries=10;// As defined in the function
864
+
865
+
// Mock AWS request to always fail with ConflictException
expect(serverless._logMessages).to.include(`[serverless-api-gateway-caching] Maximum retries (${maxRetries}) reached. Failed to update API Gateway cache settings.`);
879
+
});
880
+
881
+
it('should fail immediately on non-retryable error',async()=>{
882
+
constotherError=newError('Some other API Gateway error');
883
+
otherError.code='BadRequestException';// Example non-retryable code
884
+
885
+
// Mock AWS request to fail with a non-retryable error
0 commit comments