fix(central-ui): Test Run banner says Notify is simulated; sandbox Send logs it (#151)
The Test Run banner in TemplateScriptDialog and SharedScriptForm claimed
External, Database and Notify all fire for real ("real emails"). Notify
is SandboxNotifyTarget, which returns a random GUID and sends nothing.
The banner now says External/Database are real and Notify is simulated,
pointing at Flow Debugger on a deployed instance for a real send. The
sandbox Send also writes a [sandbox] ... not delivered line to the
console pane. Notify.Status is unchanged (reports Unknown). Tests pin
the banner wording and the console line; Component-CentralUI.md notes
the simulated Notify.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Design;
|
||||
|
||||
/// <summary>
|
||||
/// Regression tests for the Test Run side-effect warning. Test Run wires <c>External</c>,
|
||||
/// <c>Database</c>, and <c>Notify</c> to central's real services, so a Test Run
|
||||
/// has production-equivalent side effects. The finding asked, at minimum, that
|
||||
/// Regression tests for the Test Run side-effect warning. Test Run wires <c>External</c>
|
||||
/// and <c>Database</c> to central's real services, so a Test Run has
|
||||
/// production-equivalent side effects; <c>Notify</c> is simulated (Gitea #151) and the
|
||||
/// warning must say so rather than promise real emails. The finding asked, at minimum, that
|
||||
/// this blast radius be surfaced to the user. The Test Run panels in
|
||||
/// <c>SharedScriptForm</c> and <c>TemplateEdit</c> carry a prominent
|
||||
/// <c>Real I/O</c> badge and an <c>alert-warning</c> block stating the side
|
||||
@@ -47,6 +48,11 @@ public class TestRunWarningTests
|
||||
Assert.Contains("alert-warning", markup);
|
||||
Assert.Contains("fire for real", markup);
|
||||
Assert.Contains("Side effects are permanent", markup);
|
||||
// Gitea #151: Notify is simulated in the sandbox — the banner must not claim
|
||||
// real emails, and must point at Flow Debugger for a real send.
|
||||
Assert.DoesNotContain("real emails", markup);
|
||||
Assert.Contains("<code>Notify</code> is simulated", markup);
|
||||
Assert.Contains("Flow Debugger", markup);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the API method form Test Run shows no real I/O badge because the inbound API has no side-effect surface.</summary>
|
||||
|
||||
+23
@@ -674,6 +674,29 @@ public class ScriptAnalysisServiceTests
|
||||
Assert.Equal("\"Unknown\"", result.ReturnValueJson);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gitea #151: the sandbox Notify.Send delivers nothing, so it must say so in the
|
||||
/// Test Run console pane, and still return a fake NotificationId (a 32-hex GUID).
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunInSandbox_NotifySend_WritesNotDeliveredLine_AndReturnsFakeId()
|
||||
{
|
||||
var result = await _svc.RunInSandboxAsync(
|
||||
new SandboxRunRequest(
|
||||
"return await Notify.To(\"ops\").Send(\"subj\", \"body\");",
|
||||
Parameters: null,
|
||||
TimeoutSeconds: null),
|
||||
CancellationToken.None);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.Contains(
|
||||
"[sandbox] Notify.To(\"ops\").Send not delivered — Test Run does not send notifications",
|
||||
result.ConsoleOutput);
|
||||
var id = System.Text.Json.JsonSerializer.Deserialize<string>(result.ReturnValueJson!);
|
||||
Assert.True(Guid.TryParseExact(id, "N", out _));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the sandbox captures console output.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user