Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions eng/package-release-dry-run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ $resolverPath = Join-Path $repoRoot "eng/resolve-package-release.ps1"
$archiveInspectorPath = Join-Path $repoRoot "eng/package-archive-inspect.ps1"
$consumerSmokePath = Join-Path $repoRoot "eng/package-consumer-smoke.ps1"
$feedVerifyPath = Join-Path $repoRoot "eng/package-feed-verify.ps1"
$testRunnerPath = Join-Path $repoRoot "eng/test.ps1"

try {
$resolveArgs = @{
Expand Down Expand Up @@ -133,13 +134,12 @@ try {
"--no-restore",
"-p:ContinuousIntegrationBuild=true"
) "Solution build failed."
Invoke-Step "dotnet" @(
"test",
"FluxFlow.sln",
"--configuration",
$Configuration,
"--no-build"
) "Solution tests failed."
foreach ($suite in @("Unit", "Acceptance", "Integration")) {
& $testRunnerPath -Suite $suite -Configuration $Configuration -NoBuild
if ($LASTEXITCODE -ne 0) {
throw "$suite tests failed."
}
}
}

$stalePackagePattern = "^$([regex]::Escape($packageId))\.\d[^/\\]*\.s?nupkg$"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ public async Task TriggerNode_IsAFlowNode_WithPropagatingFault()
// The trigger is a first-class node: it carries the uniform lifecycle contract.
node.ShouldBeAssignableTo<IFlowNode>();

node.Fault(new InvalidOperationException("boom"));
await Should.ThrowAsync<InvalidOperationException>(
var fault = new InvalidOperationException("boom");
node.Fault(fault);
var observed = await Record.ExceptionAsync(
() => node.Completion.WaitAsync(TimeSpan.FromSeconds(30)));

observed.ShouldNotBeNull();
node.Completion.IsFaulted.ShouldBeTrue();
node.Completion.Exception!.Flatten().InnerExceptions.ShouldContain(fault);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public async Task Request_FlowsToOutput_WithMintedCorrelationId()
await using var bridge = new RequestReplyCoordinator<string, string>();
var context = new FakeContext("ping");

var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);

var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
request.Value.ShouldBe("ping");
request.CorrelationId.HasValue.ShouldBeTrue();
request.CorrelationId.Value.IsEmpty.ShouldBeFalse();
Expand Down Expand Up @@ -71,19 +72,21 @@ public async Task HostSuppliedCorrelationId_IsHonoured()
{
await using var bridge = new RequestReplyCoordinator<string, string>();
var id = new CorrelationId("trace-7");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(new FakeContext("ping", id));

(await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30))).CorrelationId.ShouldBe(id);
(await receive.WaitAsync(TimeSpan.FromSeconds(30))).CorrelationId.ShouldBe(id);
}

[Fact]
public async Task Response_RepliesToContext_AndEvicts()
{
await using var bridge = new RequestReplyCoordinator<string, string>();
var context = new FakeContext("hello");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);

var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
await bridge.Responses.SendAsync(request.With("world"));

await context.Settled.WaitAsync(TimeSpan.FromSeconds(30));
Expand All @@ -99,8 +102,9 @@ public async Task RequestReplyMode_EmitsPublishedEventAfterRequestReachesOutput(
var events = Sink(bridge.Events);
var context = new FakeContext("hello");

var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
await bridge.Responses.SendAsync(request.With("world"));
await context.Settled.WaitAsync(TimeSpan.FromSeconds(30));

Expand Down Expand Up @@ -144,8 +148,9 @@ public async Task Timeout_FailsContext_AndEvicts()
},
clock);
var context = new FakeContext("slow");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30)); // now in-flight
await receive.WaitAsync(TimeSpan.FromSeconds(30)); // now in-flight

clock.Advance(TimeSpan.FromMilliseconds(350)); // past deadline; fires a sweep

Expand Down Expand Up @@ -184,9 +189,10 @@ public async Task NullRequestContext_ReportsError_AndContinues()
flowEvent.ToFlowEvent().Level.ShouldBe(FlowEventLevel.Error);

var context = new FakeContext("valid");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);

var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
request.Value.ShouldBe("valid");
await bridge.Responses.SendAsync(request.With("ok"));
await context.Settled.WaitAsync(TimeSpan.FromSeconds(30));
Expand All @@ -209,8 +215,9 @@ public async Task NullResponseMessage_ReportsError_AndContinues()
flowEvent.ToFlowEvent().Level.ShouldBe(FlowEventLevel.Error);

var context = new FakeContext("valid");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
await bridge.Responses.SendAsync(request.With("ok"));

await context.Settled.WaitAsync(TimeSpan.FromSeconds(30));
Expand Down Expand Up @@ -249,8 +256,9 @@ public async Task Complete_FailsInFlightCallers_AndSettlesCompletion()
{
await using var bridge = new RequestReplyCoordinator<string, string>();
var context = new FakeContext("pending");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
await receive.WaitAsync(TimeSpan.FromSeconds(30));

bridge.Complete();

Expand All @@ -265,8 +273,9 @@ public async Task DisposeAsync_FailsInFlightCallers_AndSettlesCompletion()
{
var bridge = new RequestReplyCoordinator<string, string>();
var context = new FakeContext("pending");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
await receive.WaitAsync(TimeSpan.FromSeconds(30));

await bridge.DisposeAsync();

Expand Down Expand Up @@ -339,10 +348,11 @@ public async Task FireAndForget_PublishesThenAcknowledges_WithoutHoldingInFlight
new RequestReplyOptions { Mode = RequestReplyMode.FireAndForget });
var context = new FakeContext("ingest");

var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);

// The request is published into the graph...
var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));
request.Value.ShouldBe("ingest");
request.CorrelationId.HasValue.ShouldBeTrue();
request.CorrelationId.Value.IsEmpty.ShouldBeFalse();
Expand All @@ -362,8 +372,9 @@ public async Task FireAndForget_IgnoresLateResponses()
new RequestReplyOptions { Mode = RequestReplyMode.FireAndForget });
var events = Sink(bridge.Events);
var context = new FakeContext("ingest");
var receive = bridge.Output.ReceiveAsync();
await bridge.Incoming.SendAsync(context);
var request = await bridge.Output.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(30));
var request = await receive.WaitAsync(TimeSpan.FromSeconds(30));

// A response for a fire-and-forget request has nothing to match; it is reported
// unmatched like any orphan rather than replying to the (already-acked) caller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ namespace FluxFlow.Release.Tests;
[Collection(ReleaseProcessCollection.Name)]
public sealed class PackageReleaseDryRunScriptTests
{
[Fact]
public void Release_dry_run_uses_explicit_suites_before_packing()
{
var root = ReleaseTestPaths.FindRepositoryRoot();
var script = File.ReadAllText(Path.Combine(root, "eng", "package-release-dry-run.ps1"));
var buildStart = script.IndexOf("if (-not $SkipSolutionBuild)", StringComparison.Ordinal);
var packStart = script.IndexOf("$stalePackagePattern =", StringComparison.Ordinal);
buildStart.ShouldBeGreaterThanOrEqualTo(0);
packStart.ShouldBeGreaterThan(buildStart);
var validation = script[buildStart..packStart];

validation.ShouldContain("foreach ($suite in @(\"Unit\", \"Acceptance\", \"Integration\"))");
validation.ShouldContain("& $testRunnerPath -Suite $suite -Configuration $Configuration -NoBuild");
validation.ShouldContain("if ($LASTEXITCODE -ne 0)");
validation.ShouldContain("throw \"$suite tests failed.\"");
validation.ShouldNotContain("\"test\"");
validation.ShouldNotContain("-IncludeLicensedDatabaseTests");
validation.ShouldNotContain("\"Smoke\"");
script.ShouldContain("$testRunnerPath = Join-Path $repoRoot \"eng/test.ps1\"");
}

[Fact]
public async Task Release_dry_run_script_prepares_resolved_package()
{
Expand Down
Loading