Files
scadalink-design/tests/ScadaLink.DeploymentManager.Tests/DeploymentComparisonTests.cs
Joseph Doherty 6ea38faa6f Phase 3C: Deployment pipeline & Store-and-Forward engine
Deployment Manager (WP-1–8, WP-16):
- DeploymentService: full pipeline (flatten→validate→send→track→audit)
- OperationLockManager: per-instance concurrency control
- StateTransitionValidator: Enabled/Disabled/NotDeployed transition matrix
- ArtifactDeploymentService: broadcast to all sites with per-site results
- Deployment identity (GUID + revision hash), idempotency, staleness detection
- Instance lifecycle commands (disable/enable/delete) with deduplication

Store-and-Forward (WP-9–15):
- StoreAndForwardStorage: SQLite persistence, 3 categories, no max buffer
- StoreAndForwardService: fixed-interval retry, transient-only buffering, parking
- ReplicationService: async best-effort to standby (fire-and-forget)
- Parked message management (query/retry/discard from central)
- Messages survive instance deletion, S&F drains on disable

620 tests pass (+79 new), zero warnings.
2026-03-16 21:27:18 -04:00

38 lines
1.2 KiB
C#

namespace ScadaLink.DeploymentManager.Tests;
/// <summary>
/// WP-8: Tests for deployed vs template-derived state comparison.
/// </summary>
public class DeploymentComparisonTests
{
[Fact]
public void DeploymentComparisonResult_MatchingHashes_NotStale()
{
var result = new DeploymentComparisonResult(
1, "sha256:abc", "sha256:abc", false, DateTimeOffset.UtcNow);
Assert.False(result.IsStale);
Assert.Equal("sha256:abc", result.DeployedRevisionHash);
Assert.Equal("sha256:abc", result.CurrentRevisionHash);
}
[Fact]
public void DeploymentComparisonResult_DifferentHashes_IsStale()
{
var result = new DeploymentComparisonResult(
1, "sha256:old", "sha256:new", true, DateTimeOffset.UtcNow);
Assert.True(result.IsStale);
Assert.NotEqual(result.DeployedRevisionHash, result.CurrentRevisionHash);
}
[Fact]
public void DeploymentComparisonResult_ContainsDeployedTimestamp()
{
var deployedAt = new DateTimeOffset(2026, 3, 16, 12, 0, 0, TimeSpan.Zero);
var result = new DeploymentComparisonResult(1, "h1", "h2", true, deployedAt);
Assert.Equal(deployedAt, result.DeployedAt);
}
}