Reformat/cleanup
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
@@ -13,7 +8,7 @@ namespace ZB.MOM.WW.CBDDC.Network.Tests;
|
||||
public class SyncOrchestratorConfirmationTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that merged peers are registered and the local node is skipped.
|
||||
/// Verifies that merged peers are registered and the local node is skipped.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task EnsurePeersRegisteredAsync_ShouldRegisterMergedPeers_AndSkipLocalNode()
|
||||
@@ -25,8 +20,8 @@ public class SyncOrchestratorConfirmationTests
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var discoveredPeers = new List<PeerNode>
|
||||
{
|
||||
new("local", "127.0.0.1:9000", now, PeerType.LanDiscovered),
|
||||
new("peer-a", "10.0.0.1:9000", now, PeerType.LanDiscovered)
|
||||
new("local", "127.0.0.1:9000", now),
|
||||
new("peer-a", "10.0.0.1:9000", now)
|
||||
};
|
||||
|
||||
var knownPeers = new List<PeerNode>
|
||||
@@ -60,7 +55,7 @@ public class SyncOrchestratorConfirmationTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that a newly discovered node is auto-registered when peer lists are refreshed.
|
||||
/// Verifies that a newly discovered node is auto-registered when peer lists are refreshed.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task EnsurePeersRegisteredAsync_WhenNewNodeJoins_ShouldAutoRegisterJoinedNode()
|
||||
@@ -85,7 +80,7 @@ public class SyncOrchestratorConfirmationTests
|
||||
var secondDiscovered = new List<PeerNode>
|
||||
{
|
||||
new("peer-static", "10.0.0.10:9000", now, PeerType.StaticRemote),
|
||||
new("peer-new", "10.0.0.25:9010", now, PeerType.LanDiscovered)
|
||||
new("peer-new", "10.0.0.25:9010", now)
|
||||
};
|
||||
var secondMerged = SyncOrchestrator.BuildMergedPeerList(secondDiscovered, knownPeers, "local");
|
||||
await orchestrator.EnsurePeersRegisteredAsync(secondMerged, "local", CancellationToken.None);
|
||||
@@ -98,7 +93,7 @@ public class SyncOrchestratorConfirmationTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that confirmations advance only for nodes where remote vector-clock entries are at or ahead.
|
||||
/// Verifies that confirmations advance only for nodes where remote vector-clock entries are at or ahead.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AdvanceConfirmationsFromVectorClockAsync_ShouldAdvanceOnlyForRemoteAtOrAhead()
|
||||
@@ -163,7 +158,7 @@ public class SyncOrchestratorConfirmationTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that pushed-batch confirmation uses the maximum timestamp and its matching hash.
|
||||
/// Verifies that pushed-batch confirmation uses the maximum timestamp and its matching hash.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AdvanceConfirmationForPushedBatchAsync_ShouldUseMaxTimestampAndHash()
|
||||
@@ -179,7 +174,8 @@ public class SyncOrchestratorConfirmationTests
|
||||
CreateEntry("source-1", 110, 5, "hash-110")
|
||||
};
|
||||
|
||||
await orchestrator.AdvanceConfirmationForPushedBatchAsync("peer-1", "source-1", pushedChanges, CancellationToken.None);
|
||||
await orchestrator.AdvanceConfirmationForPushedBatchAsync("peer-1", "source-1", pushedChanges,
|
||||
CancellationToken.None);
|
||||
|
||||
await confirmationStore.Received(1).UpdateConfirmationAsync(
|
||||
"peer-1",
|
||||
@@ -190,7 +186,7 @@ public class SyncOrchestratorConfirmationTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that no confirmation update occurs when a pushed batch is empty.
|
||||
/// Verifies that no confirmation update occurs when a pushed batch is empty.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task AdvanceConfirmationForPushedBatchAsync_ShouldSkipEmptyBatch()
|
||||
@@ -213,7 +209,8 @@ public class SyncOrchestratorConfirmationTests
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
private static SyncOrchestrator CreateOrchestrator(IOplogStore oplogStore, IPeerOplogConfirmationStore confirmationStore)
|
||||
private static SyncOrchestrator CreateOrchestrator(IOplogStore oplogStore,
|
||||
IPeerOplogConfirmationStore confirmationStore)
|
||||
{
|
||||
var discovery = Substitute.For<IDiscoveryService>();
|
||||
discovery.GetActivePeers().Returns(Array.Empty<PeerNode>());
|
||||
@@ -243,9 +240,9 @@ public class SyncOrchestratorConfirmationTests
|
||||
"users",
|
||||
$"{nodeId}-{wall}-{logic}",
|
||||
OperationType.Put,
|
||||
payload: null,
|
||||
timestamp: new HlcTimestamp(wall, logic, nodeId),
|
||||
previousHash: string.Empty,
|
||||
hash: hash);
|
||||
null,
|
||||
new HlcTimestamp(wall, logic, nodeId),
|
||||
string.Empty,
|
||||
hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user