more audit work
This commit is contained in:
29
src/__Libraries/__Tests/StellaOps.Signals.Tests/AGENTS.md
Normal file
29
src/__Libraries/__Tests/StellaOps.Signals.Tests/AGENTS.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# StellaOps.Signals.Tests - Local Agent Charter
|
||||
|
||||
## Roles
|
||||
- Backend developer
|
||||
- QA automation engineer
|
||||
|
||||
## Working directory
|
||||
- src/__Libraries/__Tests/StellaOps.Signals.Tests
|
||||
|
||||
## Allowed dependencies
|
||||
- src/Signals/StellaOps.Signals
|
||||
- src/__Libraries/StellaOps.TestKit
|
||||
|
||||
## Required reading
|
||||
- docs/README.md
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/modules/signals/README.md
|
||||
- docs/modules/signals/contracts/signals-provenance-contract.md
|
||||
|
||||
## Determinism and test rules
|
||||
- Use deterministic inputs; avoid DateTime.UtcNow, DateTimeOffset.UtcNow, Guid.NewGuid, and Random.Shared in tests.
|
||||
- Use TimeProvider and fixed seeds or fixtures for time- and randomness-dependent tests.
|
||||
- Use CultureInfo.InvariantCulture for parsing and formatting in tests.
|
||||
- Tag tests with TestCategories (Unit, Integration, Performance) and keep integration tests out of unit-only runs.
|
||||
|
||||
## Quality and safety
|
||||
- ASCII-only strings and comments unless explicitly justified.
|
||||
- Keep fixtures small and deterministic; clean up temp resources.
|
||||
10
src/__Libraries/__Tests/StellaOps.Signals.Tests/TASKS.md
Normal file
10
src/__Libraries/__Tests/StellaOps.Signals.Tests/TASKS.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Signals.Tests Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0037-M | DONE | Revalidated 2026-01-08; open findings tracked in audit report. |
|
||||
| AUDIT-0037-T | DONE | Revalidated 2026-01-08; open findings tracked in audit report. |
|
||||
| AUDIT-0037-A | DONE | Waived (test project; revalidated 2026-01-08). |
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using StellaOps.Signals.Models;
|
||||
using StellaOps.Signals.Services;
|
||||
|
||||
namespace StellaOps.Signals.Tests.TestInfrastructure;
|
||||
|
||||
internal sealed class InMemoryReachabilityCache : IReachabilityCache
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, ReachabilityFactDocument> cache = new(StringComparer.Ordinal);
|
||||
|
||||
public Task<ReachabilityFactDocument?> GetAsync(string subjectKey, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Task.FromResult(cache.TryGetValue(subjectKey, out var document) ? document : null);
|
||||
}
|
||||
|
||||
public Task SetAsync(ReachabilityFactDocument document, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
cache[document.SubjectKey] = document;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task InvalidateAsync(string subjectKey, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
cache.TryRemove(subjectKey, out _);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using StellaOps.Signals.Services;
|
||||
|
||||
namespace StellaOps.Signals.Tests.TestInfrastructure;
|
||||
|
||||
@@ -33,6 +36,12 @@ public sealed class SignalsTestFactory : WebApplicationFactory<Program>, IAsyncL
|
||||
|
||||
configuration.AddInMemoryCollection(settings);
|
||||
});
|
||||
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
services.RemoveAll<IReachabilityCache>();
|
||||
services.AddSingleton<IReachabilityCache, InMemoryReachabilityCache>();
|
||||
});
|
||||
}
|
||||
|
||||
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
|
||||
|
||||
Reference in New Issue
Block a user