tests fixes

This commit is contained in:
master
2026-01-27 08:23:42 +02:00
parent c305d05d32
commit 82caceba56
58 changed files with 651 additions and 312 deletions

View File

@@ -23,7 +23,7 @@ public sealed class HlcTimestampJsonConverter : JsonConverter<HlcTimestamp>
{
if (reader.TokenType == JsonTokenType.Null)
{
throw new JsonException("Cannot convert null value to HlcTimestamp");
return default;
}
if (reader.TokenType != JsonTokenType.String)

View File

@@ -106,8 +106,9 @@ public sealed class HybridLogicalClock : IHybridLogicalClock
_logger = logger;
_maxClockSkew = maxClockSkew ?? TimeSpan.FromMinutes(1);
// Initialize to current physical time
_lastPhysicalTime = _timeProvider.GetUtcNow().ToUnixTimeMilliseconds();
// Initialize to 0 so first Tick() will advance physical time and reset counter
// This follows the standard HLC algorithm where l starts at 0
_lastPhysicalTime = 0;
_logicalCounter = 0;
_logger.LogInformation(

View File

@@ -48,7 +48,7 @@ public sealed class ReachabilityLattice
// From RuntimeUnobserved
[(LatticeState.RuntimeUnobserved, EvidenceType.StaticReachable)] =
new(LatticeState.StaticReachable, 0.10),
new(LatticeState.Contested, -0.10), // Conflict: runtime says unobserved, static says reachable
[(LatticeState.RuntimeUnobserved, EvidenceType.StaticUnreachable)] =
new(LatticeState.ConfirmedUnreachable, 0.20),

View File

@@ -238,12 +238,14 @@ public sealed class ReplayManifestExporterTests : IDisposable
var options1 = new ReplayExportOptions
{
OutputPath = outputPath1,
IncludeCiEnvironment = false // Disable CI env to ensure determinism
IncludeCiEnvironment = false, // Disable CI env to ensure determinism
GenerateVerificationCommand = false // Disable to avoid path-specific commands
};
var options2 = new ReplayExportOptions
{
OutputPath = outputPath2,
IncludeCiEnvironment = false
IncludeCiEnvironment = false,
GenerateVerificationCommand = false
};
// Act

View File

@@ -141,8 +141,9 @@ public sealed class FeedSnapshotCoordinatorTests
// Assert
Assert.NotNull(result);
Assert.True(result.IsValid);
Assert.Null(result.MissingSources);
Assert.Null(result.DriftedSources);
// No missing or drifted sources (either null or empty is acceptable)
Assert.True(result.MissingSources is null or { Count: 0 });
Assert.True(result.DriftedSources is null or { Count: 0 });
}
[Fact]