fix(launcher): close Campaign LA LA1 review findings
This commit is contained in:
parent
4edc122085
commit
d511e4c348
12 changed files with 413 additions and 65 deletions
|
|
@ -97,6 +97,63 @@ public sealed class SessionStatusWriterTests
|
|||
writer.Started("s1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F3: both hosts share this writer but have separate reconnect command
|
||||
/// adapters. The sink therefore closes an open connection before it
|
||||
/// accepts another connected edge, preserving a coherent external
|
||||
/// lifecycle even if a host has no reconnect-specific status hook.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void SecondConnectedEdgeFirstClosesTheRetiringConnection()
|
||||
{
|
||||
using TemporaryFile file = TemporaryFile.Create();
|
||||
var writer = new SessionStatusWriter(file.Path);
|
||||
|
||||
writer.Connected("s1");
|
||||
writer.Connected("s1");
|
||||
|
||||
JsonElement[] events = File.ReadAllLines(file.Path)
|
||||
.Select(Parse)
|
||||
.ToArray();
|
||||
Assert.Equal(
|
||||
["connected", "disconnected", "connected"],
|
||||
events.Select(static item => item.GetProperty("e").GetString()));
|
||||
Assert.Equal(
|
||||
"reconnect",
|
||||
events[1].GetProperty("reason").GetString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F6: exited is a terminal fact, not an append request. Repeated host
|
||||
/// disposal and any late callback after disposal must not create a second
|
||||
/// terminal edge or resurrect the stream. If a host exits while still
|
||||
/// connected, the writer closes that connection first with a distinct,
|
||||
/// truthful reason.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ExitedIsIdempotentTerminalAndClosesAnOpenConnection()
|
||||
{
|
||||
using TemporaryFile file = TemporaryFile.Create();
|
||||
var writer = new SessionStatusWriter(file.Path);
|
||||
|
||||
writer.Connected("s1");
|
||||
writer.Exited("s1", 0, "graceful");
|
||||
writer.Exited("s1", 1, "duplicate-must-not-win");
|
||||
writer.Connected("s1");
|
||||
|
||||
JsonElement[] events = File.ReadAllLines(file.Path)
|
||||
.Select(Parse)
|
||||
.ToArray();
|
||||
Assert.Equal(
|
||||
["connected", "disconnected", "exited"],
|
||||
events.Select(static item => item.GetProperty("e").GetString()));
|
||||
Assert.Equal(
|
||||
"process-exit",
|
||||
events[1].GetProperty("reason").GetString());
|
||||
Assert.Equal(0, events[2].GetProperty("code").GetInt32());
|
||||
Assert.Equal("graceful", events[2].GetProperty("reason").GetString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// F7 (Campaign LA LA1 review fix round): replaces the earlier
|
||||
/// "DoesNotContain 'hunter2'/'password'" assertion, which could never
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue