@@ -100,7 +100,8 @@ public async Task LocalStack_ServicesReady_WithinCITimeout()
100100 }
101101
102102 _logger . LogInformation ( "=== BUG EXPLORATION TEST: LocalStack CI Timeout ===" ) ;
103- var services = new [ ] { "sqs" , "sns" , "kms" , "iam" } ;
103+ // Only check services we actually enable — IAM/STS/cloudformation are disabled in LocalStack Community
104+ var services = new [ ] { "sqs" , "sns" , "kms" } ;
104105 _logger . LogInformation ( "Testing services: {Services}" , string . Join ( ", " , services ) ) ;
105106
106107 // Use UNFIXED configuration (30-second timeout from current code)
@@ -136,21 +137,22 @@ public async Task LocalStack_ServicesReady_WithinCITimeout()
136137 }
137138 }
138139
139- // Expected behavior: All services should be available within 90 seconds
140+ // Expected behavior: All enabled services should be available within 90 seconds
140141 // On unfixed code, this will likely timeout at 30 seconds
141- var allAvailable = healthStatus . Values . All ( h => h . IsAvailable ) ;
142-
142+ var allAvailable = services . All ( s =>
143+ healthStatus . TryGetValue ( s , out var h ) && h . IsAvailable ) ;
144+
143145 if ( ! allAvailable )
144146 {
145147 var counterexample = $ "COUNTEREXAMPLE: Services not all available after { elapsedTime } . " +
146- $ "Status: { string . Join ( ", " , healthStatus . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value . Status } ") ) } ";
148+ $ "Status: { string . Join ( ", " , services . Select ( s => $ "{ s } ={ ( healthStatus . TryGetValue ( s , out var h ) ? h . Status : "missing" ) } ") ) } ";
147149 _counterexamples . Add ( counterexample ) ;
148150 _logger . LogWarning ( counterexample ) ;
149151 }
150-
151- Assert . True ( allAvailable ,
152+
153+ Assert . True ( allAvailable ,
152154 $ "Expected all services to be available. " +
153- $ "Status: { string . Join ( ", " , healthStatus . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value . Status } ") ) } ") ;
155+ $ "Status: { string . Join ( ", " , services . Select ( s => $ "{ s } ={ ( healthStatus . TryGetValue ( s , out var h ) ? h . Status : "missing" ) } ") ) } ") ;
154156 }
155157 catch ( TimeoutException ex )
156158 {
@@ -219,28 +221,31 @@ public async Task LocalStack_ExternalInstanceDetection_WithinTimeout()
219221 }
220222
221223 _logger . LogInformation ( "=== BUG EXPLORATION TEST: External Instance Detection ===" ) ;
222-
224+
223225 // Check if there's an external LocalStack instance (e.g., pre-started in GitHub Actions)
224226 var config = TestHelpers . LocalStackConfiguration . CreateForIntegrationTesting ( ) ;
225-
227+ // Only check services we actually enable
228+ var enabledServices = new [ ] { "sqs" , "sns" , "kms" } ;
229+
226230 _stopwatch . Restart ( ) ;
227-
231+
228232 try
229233 {
230234 // This will use the current (unfixed) 3-second timeout for external detection
231235 await _localStackManager ! . StartAsync ( config ) ;
232-
236+
233237 _stopwatch . Stop ( ) ;
234-
238+
235239 _logger . LogInformation ( "LocalStack started/detected after {ElapsedTime}" , _stopwatch . Elapsed ) ;
236-
240+
237241 // Check if it detected an external instance or started a new one
238242 var healthStatus = await _localStackManager . GetServicesHealthAsync ( ) ;
239- var allAvailable = healthStatus . Values . All ( h => h . IsAvailable ) ;
240-
241- Assert . True ( allAvailable ,
242- "Expected all services to be available. " +
243- $ "Status: { string . Join ( ", " , healthStatus . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value . Status } ") ) } ") ;
243+ var allAvailable = enabledServices . All ( s =>
244+ healthStatus . TryGetValue ( s , out var h ) && h . IsAvailable ) ;
245+
246+ Assert . True ( allAvailable ,
247+ "Expected all enabled services to be available. " +
248+ $ "Status: { string . Join ( ", " , enabledServices . Select ( s => $ "{ s } ={ ( healthStatus . TryGetValue ( s , out var h ) ? h . Status : "missing" ) } ") ) } ") ;
244249 }
245250 catch ( TimeoutException ex )
246251 {
@@ -301,9 +306,10 @@ public async Task LocalStack_ServiceTiming_DocumentActualInitializationTimes()
301306 _logger . LogInformation ( "=== BUG EXPLORATION TEST: Service Timing Analysis ===" ) ;
302307
303308 var config = TestHelpers . LocalStackConfiguration . CreateForIntegrationTesting ( ) ;
304- var services = config . EnabledServices . ToArray ( ) ;
305-
306- _logger . LogInformation ( "Monitoring initialization times for services: {Services}" ,
309+ // Only monitor services we actually enable — IAM/STS/cloudformation are disabled in LocalStack Community
310+ var services = new [ ] { "sqs" , "sns" , "kms" } ;
311+
312+ _logger . LogInformation ( "Monitoring initialization times for services: {Services}" ,
307313 string . Join ( ", " , services ) ) ;
308314
309315 var serviceTimings = new Dictionary < string , TimeSpan ? > ( ) ;
@@ -343,20 +349,22 @@ public async Task LocalStack_ServiceTiming_DocumentActualInitializationTimes()
343349 }
344350 }
345351
346- // Check if all services are available
347- var allAvailable = healthStatus . Values . All ( h => h . IsAvailable ) ;
348-
352+ // Check if all enabled services are available
353+ var allAvailable = services . All ( s =>
354+ healthStatus . TryGetValue ( s , out var h ) && h . IsAvailable ) ;
355+
349356 if ( ! allAvailable )
350357 {
351- var notAvailable = healthStatus . Where ( kvp => ! kvp . Value . IsAvailable )
352- . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value . Status } ") ;
358+ var notAvailable = services
359+ . Where ( s => ! healthStatus . TryGetValue ( s , out var h ) || ! h . IsAvailable )
360+ . Select ( s => $ "{ s } ={ ( healthStatus . TryGetValue ( s , out var h ) ? h . Status : "missing" ) } ") ;
353361 var counterexample = $ "COUNTEREXAMPLE: Not all services available after { _stopwatch . Elapsed } . " +
354362 $ "Not available: { string . Join ( ", " , notAvailable ) } ";
355363 _counterexamples . Add ( counterexample ) ;
356364 _logger . LogWarning ( counterexample ) ;
357365 }
358-
359- Assert . True ( allAvailable ,
366+
367+ Assert . True ( allAvailable ,
360368 $ "Expected all services to be available within timeout. " +
361369 $ "Timings: { string . Join ( ", " , serviceTimings . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value ? . TotalSeconds : F1} s") ) } ") ;
362370 }
0 commit comments