test(e2e): move deploy/disable preconditions inside try for guaranteed cleanup (review fix)
In Disable_Instance_ShowsOutcomeToast and Enable_Instance_ShowsOutcomeToast, the precondition CLI calls (DeployInstanceAsync / DisableInstanceAsync) were between CreateInstanceAsync and the try block. A throw there would skip the finally DeleteInstanceAsync, leaking the instance. Moved those calls to be the first statements inside try so cleanup always runs once the instance exists.
This commit is contained in:
+7
-7
@@ -86,11 +86,11 @@ public class DeploymentActionTests : IClassFixture<DeploymentFixture>
|
||||
Skip.IfNot(_cluster.Available, ClusterAvailability.SkipReason);
|
||||
|
||||
var (instanceId, uniqueName) = await _cluster.CreateInstanceAsync();
|
||||
// Deploy moves the instance config state to Enabled, so the context menu
|
||||
// offers "Disable" (it would offer "Enable" only for a Disabled instance).
|
||||
await CliRunner.DeployInstanceAsync(instanceId);
|
||||
try
|
||||
{
|
||||
// Deploy moves the instance config state to Enabled, so the context menu
|
||||
// offers "Disable" (it would offer "Enable" only for a Disabled instance).
|
||||
await CliRunner.DeployInstanceAsync(instanceId);
|
||||
var page = await _pw.NewAuthenticatedPageAsync();
|
||||
await OpenInstanceContextMenuAsync(page, uniqueName);
|
||||
|
||||
@@ -119,12 +119,12 @@ public class DeploymentActionTests : IClassFixture<DeploymentFixture>
|
||||
Skip.IfNot(_cluster.Available, ClusterAvailability.SkipReason);
|
||||
|
||||
var (instanceId, uniqueName) = await _cluster.CreateInstanceAsync();
|
||||
// Deploy then Disable leaves the instance config state at Disabled, so the
|
||||
// context menu offers "Enable".
|
||||
await CliRunner.DeployInstanceAsync(instanceId);
|
||||
await CliRunner.DisableInstanceAsync(instanceId);
|
||||
try
|
||||
{
|
||||
// Deploy then Disable leaves the instance config state at Disabled, so the
|
||||
// context menu offers "Enable".
|
||||
await CliRunner.DeployInstanceAsync(instanceId);
|
||||
await CliRunner.DisableInstanceAsync(instanceId);
|
||||
var page = await _pw.NewAuthenticatedPageAsync();
|
||||
await OpenInstanceContextMenuAsync(page, uniqueName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user