Reformat/cleanup
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s

This commit is contained in:
Joseph Doherty
2026-02-21 07:53:53 -05:00
parent c6f6d9329a
commit 7ebc2cb567
160 changed files with 7258 additions and 7262 deletions

View File

@@ -1,8 +1,4 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
using ZB.MOM.WW.CBDDC.Core;
using ZB.MOM.WW.CBDDC.Core.Network;
using ZB.MOM.WW.CBDDC.Core.Storage;
@@ -12,7 +8,7 @@ namespace ZB.MOM.WW.CBDDC.Network.Tests;
public class SyncOrchestratorMaintenancePruningTests
{
/// <summary>
/// Verifies that mixed peer confirmations produce the safest effective cutoff across peers and sources.
/// Verifies that mixed peer confirmations produce the safest effective cutoff across peers and sources.
/// </summary>
[Fact]
public async Task CalculateEffectiveCutoffAsync_MixedPeerStates_ShouldUseSafestConfirmationAcrossPeers()
@@ -33,16 +29,16 @@ public class SyncOrchestratorMaintenancePruningTests
confirmationStore.GetConfirmationsForPeerAsync("peer-a", Arg.Any<CancellationToken>())
.Returns(new[]
{
CreateConfirmation("peer-a", "node-local", wall: 300, logic: 0, isActive: true),
CreateConfirmation("peer-a", "node-secondary", wall: 120, logic: 1, isActive: true),
CreateConfirmation("peer-a", "node-secondary", wall: 500, logic: 0, isActive: false)
CreateConfirmation("peer-a", "node-local", 300, 0, true),
CreateConfirmation("peer-a", "node-secondary", 120, 1, true),
CreateConfirmation("peer-a", "node-secondary", 500, 0, false)
});
confirmationStore.GetConfirmationsForPeerAsync("peer-b", Arg.Any<CancellationToken>())
.Returns(new[]
{
CreateConfirmation("peer-b", "node-local", wall: 250, logic: 0, isActive: true),
CreateConfirmation("peer-b", "node-secondary", wall: 180, logic: 0, isActive: true)
CreateConfirmation("peer-b", "node-local", 250, 0, true),
CreateConfirmation("peer-b", "node-secondary", 180, 0, true)
});
var decision = await calculator.CalculateEffectiveCutoffAsync(
@@ -63,7 +59,7 @@ public class SyncOrchestratorMaintenancePruningTests
}
/// <summary>
/// Verifies that removing a peer from tracking immediately restores pruning eligibility.
/// Verifies that removing a peer from tracking immediately restores pruning eligibility.
/// </summary>
[Fact]
public async Task CalculateEffectiveCutoffAsync_RemovingPeerFromTracking_ShouldImmediatelyRestoreEligibility()
@@ -85,7 +81,7 @@ public class SyncOrchestratorMaintenancePruningTests
confirmationStore.GetConfirmationsForPeerAsync("peer-active", Arg.Any<CancellationToken>())
.Returns(new[]
{
CreateConfirmation("peer-active", "node-local", wall: 150, logic: 0, isActive: true)
CreateConfirmation("peer-active", "node-local", 150, 0, true)
});
confirmationStore.GetConfirmationsForPeerAsync("peer-deprecated", Arg.Any<CancellationToken>())
.Returns(Array.Empty<PeerOplogConfirmation>());
@@ -108,11 +104,12 @@ public class SyncOrchestratorMaintenancePruningTests
unblockedDecision.EffectiveCutoff.Value.NodeId.ShouldBe("node-local");
await confirmationStore.Received(1).GetConfirmationsForPeerAsync("peer-active", Arg.Any<CancellationToken>());
await confirmationStore.DidNotReceive().GetConfirmationsForPeerAsync("peer-deprecated", Arg.Any<CancellationToken>());
await confirmationStore.DidNotReceive()
.GetConfirmationsForPeerAsync("peer-deprecated", Arg.Any<CancellationToken>());
}
/// <summary>
/// Verifies that maintenance does not prune when peer confirmation is missing in a two-node topology.
/// Verifies that maintenance does not prune when peer confirmation is missing in a two-node topology.
/// </summary>
[Fact]
public async Task RunMaintenanceIfDueAsync_TwoNode_ShouldNotPruneBeforePeerConfirmation()
@@ -145,7 +142,7 @@ public class SyncOrchestratorMaintenancePruningTests
}
/// <summary>
/// Verifies that maintenance prunes after peer confirmation is available in a two-node topology.
/// Verifies that maintenance prunes after peer confirmation is available in a two-node topology.
/// </summary>
[Fact]
public async Task RunMaintenanceIfDueAsync_TwoNode_ShouldPruneAfterPeerConfirmation()
@@ -194,7 +191,7 @@ public class SyncOrchestratorMaintenancePruningTests
}
/// <summary>
/// Verifies that deprecated-node removal unblocks pruning on a subsequent maintenance run.
/// Verifies that deprecated-node removal unblocks pruning on a subsequent maintenance run.
/// </summary>
[Fact]
public async Task RunMaintenanceIfDueAsync_DeprecatedNodeRemoval_ShouldUnblockPruning()
@@ -217,7 +214,7 @@ public class SyncOrchestratorMaintenancePruningTests
confirmationStore.GetConfirmationsForPeerAsync("node-active", Arg.Any<CancellationToken>())
.Returns(new[]
{
CreateConfirmation("node-active", "node-local", wall: 100, logic: 0, isActive: true)
CreateConfirmation("node-active", "node-local", 100, 0, true)
});
confirmationStore.GetConfirmationsForPeerAsync("node-deprecated", Arg.Any<CancellationToken>())
.Returns(Array.Empty<PeerOplogConfirmation>());
@@ -289,4 +286,4 @@ public class SyncOrchestratorMaintenancePruningTests
IsActive = isActive
};
}
}
}