stabilize tests

This commit is contained in:
master
2026-02-01 21:37:40 +02:00
parent 55744f6a39
commit 5d5e80b2e4
6435 changed files with 33984 additions and 13802 deletions

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0349-M | DONE | Revalidated 2026-01-07; maintainability audit for Router Gateway WebService tests. |
| AUDIT-0349-T | DONE | Revalidated 2026-01-07; test coverage audit for Router Gateway WebService tests. |
| AUDIT-0349-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0384-M | DONE | Revalidated 2026-01-07; maintainability audit for Valkey transport tests. |
| AUDIT-0384-T | DONE | Revalidated 2026-01-07; test coverage audit for Valkey transport tests. |
| AUDIT-0384-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0391-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Microservice.SourceGen.Tests. |
| AUDIT-0391-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Microservice.SourceGen.Tests. |
| AUDIT-0391-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0393-M | DONE | Revalidated 2026-01-07; maintainability audit for Router StellaOps.Microservice.Tests. |
| AUDIT-0393-T | DONE | Revalidated 2026-01-07; test coverage audit for Router StellaOps.Microservice.Tests. |
| AUDIT-0393-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.AspNet.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.AspNet.Tests/StellaOps.Router.AspNet.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Common.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Common.Tests/StellaOps.Router.Common.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Config.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Config.Tests/StellaOps.Router.Config.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Gateway.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Gateway.Tests/StellaOps.Router.Gateway.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Integration.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Integration.Tests/StellaOps.Router.Integration.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Transport.InMemory.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Transport.InMemory.Tests/StellaOps.Router.Transport.InMemory.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0763-M | DONE | Revalidated 2026-01-07 (test project). |
| AUDIT-0763-T | DONE | Revalidated 2026-01-07. |
| AUDIT-0763-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,17 @@
# StellaOps.Router.Transport.RabbitMq.Tests Agent Charter
## Mission
Provide deterministic unit tests and env-gated integration tests for the RabbitMQ transport layer.
## Required Reading
- `docs/modules/router/architecture.md`
- `docs/modules/platform/architecture-overview.md`
## Working Agreement
- Update sprint status in `docs/implplan/SPRINT_*.md` and local TASKS.md.
- Keep unit tests deterministic and offline-friendly.
- Integration tests require `STELLAOPS_TEST_RABBITMQ=1` and a running RabbitMQ instance.
## Known Quirks
- **Q9 — RabbitMQ broker restart recovery**: After a broker restart, the RabbitMQ client library's automatic recovery reconnects the TCP socket but does NOT re-establish consumers or re-declare topology. Both `RabbitMqTransportClient` and `RabbitMqTransportServer` wire `connection.RecoverySucceededAsync` to call `DeclareTopologyAsync()` + `StartConsumerAsync()` (and re-send HELLO in the client) to fully recover. Tests: `ConnectionRecovery_BrokerRestart_*` require `STELLAOPS_TEST_RABBITMQ=1`.
- **Env-gated tests**: 30 tests are skipped unless `STELLAOPS_TEST_RABBITMQ=1` is set. With the env var and a running RabbitMQ broker, all 110 tests should pass.

View File

@@ -89,6 +89,35 @@ public sealed class RabbitMqContainerFixture : RouterCollectionFixture, IAsyncDi
await _container.StopAsync();
await _container.StartAsync();
// Wait for broker to accept AMQP connections after restart.
// Testcontainers StartAsync returns when the container process starts,
// but RabbitMQ may need additional time to initialize and bind its ports.
await WaitForBrokerReadyAsync(TimeSpan.FromSeconds(30));
}
private async Task WaitForBrokerReadyAsync(TimeSpan timeout)
{
var deadline = DateTime.UtcNow + timeout;
while (DateTime.UtcNow < deadline)
{
try
{
var factory = new global::RabbitMQ.Client.ConnectionFactory
{
HostName = HostName,
Port = Port,
UserName = UserName,
Password = Password,
};
await using var conn = await factory.CreateConnectionAsync();
return; // Broker is ready
}
catch
{
await Task.Delay(500);
}
}
}
/// <inheritdoc />

View File

@@ -329,10 +329,10 @@ public sealed class RabbitMqIntegrationTests : IAsyncLifetime
await _client.SendHeartbeatAsync(heartbeat, CancellationToken.None);
return true;
},
timeout: TimeSpan.FromSeconds(30),
timeout: TimeSpan.FromSeconds(45),
swallowExceptions: true);
await heartbeatReceived.Task.WaitAsync(TimeSpan.FromSeconds(30));
await heartbeatReceived.Task.WaitAsync(TimeSpan.FromSeconds(45));
}
#endregion
@@ -384,7 +384,17 @@ public sealed class RabbitMqIntegrationTests : IAsyncLifetime
await Task.Delay(pollInterval.Value);
}
(await predicate()).Should().BeTrue("condition should become true within {0}", timeout);
// Final assertion: wrap in try/catch to convert connection exceptions
// into assertion failures with a clear message.
try
{
(await predicate()).Should().BeTrue("condition should become true within {0}", timeout);
}
catch (Exception ex) when (swallowExceptions && ex is not FluentAssertions.Execution.AssertionFailedException)
{
throw new Xunit.Sdk.XunitException(
$"Condition did not become true within {timeout}. Last exception: {ex.GetType().Name}: {ex.Message}");
}
}
#region Queue Declaration Tests

View File

@@ -443,11 +443,11 @@ public sealed class RabbitMqTransportComplianceTests : IAsyncLifetime
await _client.SendHeartbeatAsync(heartbeat, CancellationToken.None);
return true;
},
timeout: TimeSpan.FromSeconds(30),
timeout: TimeSpan.FromSeconds(45),
swallowExceptions: true);
// Assert
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(15));
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(45));
await postRestartReceived.Task.WaitAsync(cts.Token);
_output.WriteLine("Connection resilience test passed");
@@ -587,7 +587,17 @@ public sealed class RabbitMqTransportComplianceTests : IAsyncLifetime
await Task.Delay(pollInterval.Value);
}
(await predicate()).Should().BeTrue("condition should become true within {0}", timeout);
// Final assertion: wrap in try/catch to convert connection exceptions
// into assertion failures with a clear message.
try
{
(await predicate()).Should().BeTrue("condition should become true within {0}", timeout);
}
catch (Exception ex) when (swallowExceptions && ex is not FluentAssertions.Execution.AssertionFailedException)
{
throw new Xunit.Sdk.XunitException(
$"Condition did not become true within {timeout}. Last exception: {ex.GetType().Name}: {ex.Message}");
}
}
#endregion

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Transport.RabbitMq.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Transport.RabbitMq.Tests/StellaOps.Router.Transport.RabbitMq.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Transport.Tcp.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Transport.Tcp.Tests/StellaOps.Router.Transport.Tcp.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Transport.Tls.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Transport.Tls.Tests/StellaOps.Router.Transport.Tls.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Transport.Udp.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/StellaOps.Router.Transport.Udp.Tests/StellaOps.Router.Transport.Udp.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0380-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Messaging.Testing. |
| AUDIT-0380-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Messaging.Testing. |
| AUDIT-0380-A | DONE | Waived (test project; revalidated 2026-01-07). |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.Router.Testing Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Tests/__Libraries/StellaOps.Router.Testing/StellaOps.Router.Testing.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |