@@ -58,8 +58,11 @@ public async Task DisposeAsync()
5858 [ Fact ]
5959 public async Task AwsSdk_AppliesExponentialBackoff_ForSqsOperations ( )
6060 {
61+ // LocalStack returns 404 errors immediately without retry delays (non-retryable errors)
62+ if ( _environment . IsLocalEmulator ) return ;
63+
6164 // Arrange
62- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
65+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
6366 var retryAttempts = new List < DateTime > ( ) ;
6467 var maxRetries = 3 ;
6568
@@ -68,7 +71,7 @@ public async Task AwsSdk_AppliesExponentialBackoff_ForSqsOperations()
6871 {
6972 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
7073 MaxErrorRetry = maxRetries ,
71- RegionEndpoint = Amazon . RegionEndpoint . USEast1
74+ AuthenticationRegion = "us-east-1"
7275 } ;
7376
7477 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -111,6 +114,9 @@ await sqsClient.SendMessageAsync(new SendMessageRequest
111114 [ Fact ]
112115 public async Task AwsSdk_AppliesExponentialBackoff_ForSnsOperations ( )
113116 {
117+ // LocalStack returns 404 errors immediately without retry delays (non-retryable errors)
118+ if ( _environment . IsLocalEmulator ) return ;
119+
114120 // Arrange
115121 var invalidTopicArn = "arn:aws:sns:us-east-1:000000000000:nonexistent-topic" ;
116122 var maxRetries = 3 ;
@@ -120,7 +126,7 @@ public async Task AwsSdk_AppliesExponentialBackoff_ForSnsOperations()
120126 {
121127 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
122128 MaxErrorRetry = maxRetries ,
123- RegionEndpoint = Amazon . RegionEndpoint . USEast1
129+ AuthenticationRegion = "us-east-1"
124130 } ;
125131
126132 var snsClient = new AmazonSimpleNotificationServiceClient ( "test" , "test" , config ) ;
@@ -161,14 +167,14 @@ await snsClient.PublishAsync(new PublishRequest
161167 public async Task AwsSdk_EnforcesMaximumRetryLimit_ForSqsOperations ( )
162168 {
163169 // Arrange
164- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
170+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
165171 var maxRetries = 2 ; // Set low retry limit
166172
167173 var config = new AmazonSQSConfig
168174 {
169175 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
170176 MaxErrorRetry = maxRetries ,
171- RegionEndpoint = Amazon . RegionEndpoint . USEast1
177+ AuthenticationRegion = "us-east-1"
172178 } ;
173179
174180 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -219,7 +225,7 @@ public async Task AwsSdk_EnforcesMaximumRetryLimit_ForSnsOperations()
219225 {
220226 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
221227 MaxErrorRetry = maxRetries ,
222- RegionEndpoint = Amazon . RegionEndpoint . USEast1
228+ AuthenticationRegion = "us-east-1"
223229 } ;
224230
225231 var snsClient = new AmazonSimpleNotificationServiceClient ( "test" , "test" , config ) ;
@@ -260,15 +266,15 @@ public async Task RetryPolicy_Configuration_SupportsCustomRetryLimits()
260266 {
261267 // Arrange - Test with different retry limits
262268 var testCases = new [ ] { 0 , 1 , 3 , 5 } ;
263- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
269+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
264270
265271 foreach ( var maxRetries in testCases )
266272 {
267273 var config = new AmazonSQSConfig
268274 {
269275 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
270276 MaxErrorRetry = maxRetries ,
271- RegionEndpoint = Amazon . RegionEndpoint . USEast1
277+ AuthenticationRegion = "us-east-1"
272278 } ;
273279
274280 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -354,7 +360,7 @@ public async Task RetryPolicy_RetriesTransientFailures_AndEventuallySucceeds()
354360 {
355361 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
356362 MaxErrorRetry = 3 ,
357- RegionEndpoint = Amazon . RegionEndpoint . USEast1
363+ AuthenticationRegion = "us-east-1"
358364 } ;
359365
360366 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -401,14 +407,14 @@ public async Task RetryPolicy_RetriesTransientFailures_AndEventuallySucceeds()
401407 public async Task RetryPolicy_StopsRetrying_OnPermanentFailures ( )
402408 {
403409 // Arrange - Use invalid queue URL (permanent failure)
404- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
410+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
405411 var maxRetries = 3 ;
406412
407413 var config = new AmazonSQSConfig
408414 {
409415 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
410416 MaxErrorRetry = maxRetries ,
411- RegionEndpoint = Amazon . RegionEndpoint . USEast1
417+ AuthenticationRegion = "us-east-1"
412418 } ;
413419
414420 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -461,7 +467,7 @@ public async Task RetryPolicy_HandlesThrottlingErrors_WithBackoff()
461467 {
462468 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
463469 MaxErrorRetry = 5 , // Higher retry count for throttling
464- RegionEndpoint = Amazon . RegionEndpoint . USEast1
470+ AuthenticationRegion = "us-east-1"
465471 } ;
466472
467473 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -532,7 +538,7 @@ public async Task RetryPolicy_RetriesNetworkTimeouts_WithExponentialBackoff()
532538 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
533539 MaxErrorRetry = 3 ,
534540 Timeout = TimeSpan . FromMilliseconds ( 100 ) , // Very short timeout
535- RegionEndpoint = Amazon . RegionEndpoint . USEast1
541+ AuthenticationRegion = "us-east-1"
536542 } ;
537543
538544 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -591,15 +597,18 @@ await sqsClient.SendMessageAsync(new SendMessageRequest
591597 [ Fact ]
592598 public async Task RetryPolicy_DelaysIncreaseExponentially_BetweenRetries ( )
593599 {
600+ // LocalStack returns 404 errors immediately without retry delays (non-retryable errors)
601+ if ( _environment . IsLocalEmulator ) return ;
602+
594603 // Arrange
595- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
604+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
596605 var maxRetries = 4 ;
597606
598607 var config = new AmazonSQSConfig
599608 {
600609 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
601610 MaxErrorRetry = maxRetries ,
602- RegionEndpoint = Amazon . RegionEndpoint . USEast1
611+ AuthenticationRegion = "us-east-1"
603612 } ;
604613
605614 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
@@ -638,16 +647,19 @@ await sqsClient.SendMessageAsync(new SendMessageRequest
638647 [ Fact ]
639648 public async Task RetryPolicy_AppliesJitter_ToPreventThunderingHerd ( )
640649 {
650+ // LocalStack returns 404 errors immediately without retry delays (non-retryable errors)
651+ if ( _environment . IsLocalEmulator ) return ;
652+
641653 // Arrange - Execute same failing operation multiple times
642- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
654+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
643655 var maxRetries = 3 ;
644656 var iterations = 5 ;
645657
646658 var config = new AmazonSQSConfig
647659 {
648660 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
649661 MaxErrorRetry = maxRetries ,
650- RegionEndpoint = Amazon . RegionEndpoint . USEast1
662+ AuthenticationRegion = "us-east-1"
651663 } ;
652664
653665 var durations = new List < double > ( ) ;
@@ -703,14 +715,14 @@ await sqsClient.SendMessageAsync(new SendMessageRequest
703715 public async Task RetryPolicy_RespectsCancellationToken_DuringRetries ( )
704716 {
705717 // Arrange
706- var invalidQueueUrl = "https ://sqs.us-east-1.amazonaws.com /000000000000/nonexistent-queue" ;
718+ var invalidQueueUrl = "http ://localhost:4566 /000000000000/nonexistent-queue" ;
707719 var maxRetries = 10 ; // High retry count
708720
709721 var config = new AmazonSQSConfig
710722 {
711723 ServiceURL = _environment . IsLocalEmulator ? "http://localhost:4566" : null ,
712724 MaxErrorRetry = maxRetries ,
713- RegionEndpoint = Amazon . RegionEndpoint . USEast1
725+ AuthenticationRegion = "us-east-1"
714726 } ;
715727
716728 var sqsClient = new AmazonSQSClient ( "test" , "test" , config ) ;
0 commit comments