diff --git a/src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DeployCommands.cs b/src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DeployCommands.cs
index 62a20704..caf208d4 100644
--- a/src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DeployCommands.cs
+++ b/src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DeployCommands.cs
@@ -115,7 +115,8 @@ public static class DeployCommands
result, urlOption, formatOption, usernameOption, passwordOption,
new MgmtDeployAreaCommand(areaId, force),
timeout: BulkDeployTimeout,
- onSuccess: json => HandleSiteDeploymentResponse(json, CommandHelpers.ResolveFormat(result, formatOption, CliConfig.Load())));
+ onSuccess: json => HandleSiteDeploymentResponse(
+ json, CommandHelpers.ResolveFormat(result, formatOption, CliConfig.Load()), "area deployment"));
});
return cmd;
}
diff --git a/tests/ZB.MOM.WW.ScadaBridge.CLI.Tests/DeployAreaExitCodeTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CLI.Tests/DeployAreaExitCodeTests.cs
index 557154ac..f77e27ab 100644
--- a/tests/ZB.MOM.WW.ScadaBridge.CLI.Tests/DeployAreaExitCodeTests.cs
+++ b/tests/ZB.MOM.WW.ScadaBridge.CLI.Tests/DeployAreaExitCodeTests.cs
@@ -13,6 +13,7 @@ namespace ZB.MOM.WW.ScadaBridge.CLI.Tests;
/// exactly like deploy site: a per-instance failure is a successful HTTP
/// call, so without that a script could not detect it.
///
+[Collection("Console")]
public class DeployAreaExitCodeTests
{
/// Verifies the wire payload and the exit code derived from the summary.
@@ -65,8 +66,23 @@ public class DeployAreaExitCodeTests
string[] args = ["deploy", "area", "--id", "12", "--url", $"http://127.0.0.1:{port}",
"--username", "test", "--password", "test", "--format", "json"];
if (force) args = [.. args, "--force"];
- var exit = await root.Parse(args).InvokeAsync();
- await server.WaitAsync(TimeSpan.FromSeconds(5));
+ var stderr = new StringWriter();
+ var originalError = Console.Error;
+ Console.SetError(stderr);
+ int exit;
+ try
+ {
+ exit = await root.Parse(args).InvokeAsync();
+ await server.WaitAsync(TimeSpan.FromSeconds(5));
+ }
+ finally
+ {
+ Console.SetError(originalError);
+ }
+
+ // A malformed summary is named for what was asked: an AREA deployment.
+ if (response.Contains("unexpected"))
+ Assert.Contains("invalid area deployment summary", stderr.ToString());
Assert.Equal(expected, exit);
using var payload = JsonDocument.Parse(requestBody!);