@@ -21,8 +21,6 @@ internal static class IsolatedTeardown
2121 private const int EmptyCount = 0 ;
2222 private const string ServerResourceValue = "server-resource" ;
2323 private const string ServerResourceTaskOwnershipWasIncompleteMessage = "Server resource task ownership was incomplete." ;
24- private const string StopStage = "stop" ;
25- private const string ResourcesStopStage = "resources-stop" ;
2624 private const string SessionStateJsonFileName = "session-state.json" ;
2725 private const string SessionJsonFileName = "session.json" ;
2826 private const string SessionResourceEvidenceJsonFileName = "session-resource-evidence.json" ;
@@ -55,7 +53,6 @@ private static async Task CompleteCoreAsync(DistributedApplication app, Comparis
5553 var runnerSettled = await IsolatedOriginalTaskSettlement . RunAsync (
5654 work . StopRunnerAsync , ExecutionRunnerValue , failures , options ) ;
5755 var collectorSettled = await SettleCollectorAsync ( work , failures , options ) ;
58- var resourcesStopped = await StopResourcesAsync ( app , containers , failures , options ) ;
5956 var captureSettled = capture is null || await IsolatedOriginalTaskSettlement . RunAsync (
6057 capture . StopAsync , LogsCloseValue , failures , options ) ;
6158 if ( capture is not null )
@@ -66,15 +63,17 @@ await IsolatedOriginalTaskSettlement.RunAsync(
6663 ( ) => capture . WriteResourcesToAsync ( evidence ) , NodeLogsRetainValue , failures , options ) ;
6764 }
6865 await IsolatedOriginalTaskSettlement . RunAsync ( ( ) => CopyRawAsync ( output , evidence ) , RawReportStage , failures , options ) ;
69- var stopped = await StopAsync ( app , failures , options ) ;
7066 var captureDisposed = disposeCapture is null || await IsolatedOriginalTaskSettlement . RunAsync (
7167 disposeCapture , CaptureDisposeValue , failures , options ) ;
68+ // Own the testing factory's original disposal task, including its configured host shutdown budget.
69+ // The testing application's cancelable StopAsync wait does not own that task's completion.
7270 var applicationDisposed = await IsolatedOriginalTaskSettlement . RunAsync (
73- ( ) => app . DisposeAsync ( ) . AsTask ( ) , AppDisposeValue , failures , options ) ;
74- var reportsRetained = stopped && applicationDisposed
71+ ( ) => app . DisposeAsync ( ) . AsTask ( ) , AppDisposeValue , failures , options ,
72+ shutdownAllowance : work . HostShutdownTimeout ) ;
73+ var reportsRetained = applicationDisposed
7574 && await IsolatedOriginalTaskSettlement . RunAsync ( ( ) => RetainReportsAsync ( output , evidence ) ,
7675 ExecutionTrxRetainValue , failures , options ) ;
77- if ( runnerSettled && collectorSettled && resourcesStopped && captureSettled && captureDisposed && stopped && applicationDisposed && reportsRetained )
76+ if ( runnerSettled && collectorSettled && captureSettled && captureDisposed && applicationDisposed && reportsRetained )
7877 {
7978 await IsolatedOriginalTaskSettlement . RunAsync (
8079 ( ) => IsolatedDataCleanup . DeleteAsync ( root , containers ) , DataStage , failures , options ) ;
@@ -124,23 +123,6 @@ private static async Task<bool> SettleCollectorAsync(IsolatedOwnedWork work,
124123 return await IsolatedOriginalTaskSettlement . RunAsync ( ( ) => original , ServerResourceValue , failures , options ) ;
125124 }
126125
127- private static async Task < bool > StopAsync ( DistributedApplication app ,
128- IsolatedTeardownFailures failures , IOptions < ComparisonHarnessOptions > options )
129- {
130- using var cancellation = new CancellationTokenSource ( ) ;
131- return await IsolatedOriginalTaskSettlement . RunAsync (
132- ( ) => app . StopAsync ( cancellation . Token ) , StopStage , failures , options , cancellation . CancelAsync ) ;
133- }
134-
135- private static async Task < bool > StopResourcesAsync ( DistributedApplication app , ContainerResource [ ] containers ,
136- IsolatedTeardownFailures failures , IOptions < ComparisonHarnessOptions > options )
137- {
138- using var cancellation = new CancellationTokenSource ( ) ;
139- return await IsolatedOriginalTaskSettlement . RunAsync (
140- ( ) => IsolatedResourceShutdown . StopAsync ( app , containers , cancellation . Token ) , ResourcesStopStage ,
141- failures , options , cancellation . CancelAsync ) ;
142- }
143-
144126 private static Task RetainReportsAsync ( string output , string evidence )
145127 {
146128 WorkloadTestReports . Retain ( output , evidence ) ;
0 commit comments