Clean up generated doc-fix artifacts and document E2E helper members
All checks were successful
CI / verify (push) Successful in 2m33s
All checks were successful
CI / verify (push) Successful in 2m33s
Remove temporary docs reports/batch files and add missing XML docs in ClusterCrudSyncE2ETests support types to keep the repo clean and CommentChecker-compliant.
This commit is contained in:
@@ -240,6 +240,9 @@ public class ClusterCrudSyncE2ETests
|
||||
private long _lastPhysicalTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
private int _logicalCounter;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LiteDB-backed context used by this test peer.
|
||||
/// </summary>
|
||||
public SampleDbContext Context { get; }
|
||||
|
||||
private TestPeerNode(
|
||||
@@ -260,6 +263,14 @@ public class ClusterCrudSyncE2ETests
|
||||
_nodeId = nodeId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test peer node and wires all required services.
|
||||
/// </summary>
|
||||
/// <param name="nodeId">The unique node identifier.</param>
|
||||
/// <param name="tcpPort">The TCP port used by the node listener.</param>
|
||||
/// <param name="authToken">The cluster authentication token.</param>
|
||||
/// <param name="knownPeers">The known peers this node can connect to.</param>
|
||||
/// <returns>A configured <see cref="TestPeerNode"/> instance.</returns>
|
||||
public static TestPeerNode Create(
|
||||
string nodeId,
|
||||
int tcpPort,
|
||||
@@ -300,6 +311,10 @@ public class ClusterCrudSyncE2ETests
|
||||
return new TestPeerNode(provider, node, oplogStore, context, logSink, workDir, nodeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the underlying node when it has not been started yet.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task StartAsync()
|
||||
{
|
||||
if (_started)
|
||||
@@ -311,6 +326,10 @@ public class ClusterCrudSyncE2ETests
|
||||
_started = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the underlying node when it is currently running.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task StopAsync()
|
||||
{
|
||||
if (!_started)
|
||||
@@ -322,6 +341,7 @@ public class ClusterCrudSyncE2ETests
|
||||
_started = false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
try
|
||||
@@ -336,11 +356,21 @@ public class ClusterCrudSyncE2ETests
|
||||
TryDeleteDirectory(_workDir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a user document by identifier.
|
||||
/// </summary>
|
||||
/// <param name="userId">The identifier of the user to read.</param>
|
||||
/// <returns>The matching user when found; otherwise <see langword="null"/>.</returns>
|
||||
public User? ReadUser(string userId)
|
||||
{
|
||||
return Context.Users.Find(u => u.Id == userId).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts or updates a user and persists the matching oplog entry.
|
||||
/// </summary>
|
||||
/// <param name="user">The user payload to upsert.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task UpsertUserAsync(User user)
|
||||
{
|
||||
await PersistUserMutationWithOplogFallbackAsync(
|
||||
@@ -363,6 +393,11 @@ public class ClusterCrudSyncE2ETests
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a user and persists the matching oplog entry.
|
||||
/// </summary>
|
||||
/// <param name="userId">The identifier of the user to delete.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task DeleteUserAsync(string userId)
|
||||
{
|
||||
await PersistUserMutationWithOplogFallbackAsync(
|
||||
@@ -376,6 +411,11 @@ public class ClusterCrudSyncE2ETests
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets recent in-memory logs captured for this node.
|
||||
/// </summary>
|
||||
/// <param name="max">The maximum number of log entries to return.</param>
|
||||
/// <returns>A newline-delimited string of recent log entries.</returns>
|
||||
public string GetRecentLogs(int max = 50)
|
||||
{
|
||||
return _logSink.GetRecent(max);
|
||||
@@ -450,16 +490,19 @@ public class ClusterCrudSyncE2ETests
|
||||
|
||||
private sealed class PassiveDiscoveryService : IDiscoveryService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<PeerNode> GetActivePeers()
|
||||
{
|
||||
return Array.Empty<PeerNode>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Start()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Stop()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
@@ -470,18 +513,25 @@ public class ClusterCrudSyncE2ETests
|
||||
{
|
||||
private PeerNodeConfiguration _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StaticPeerNodeConfigurationProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="configuration">The initial peer node configuration.</param>
|
||||
public StaticPeerNodeConfigurationProvider(PeerNodeConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public event PeerNodeConfigurationChangedEventHandler? ConfigurationChanged;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<PeerNodeConfiguration> GetConfiguration()
|
||||
{
|
||||
return Task.FromResult(_configuration);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Update(PeerNodeConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
@@ -494,11 +544,22 @@ public class ClusterCrudSyncE2ETests
|
||||
private readonly ConcurrentQueue<string> _entries = new();
|
||||
private readonly string _nodeId;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InMemoryLogSink"/> class.
|
||||
/// </summary>
|
||||
/// <param name="nodeId">The node identifier associated with emitted logs.</param>
|
||||
public InMemoryLogSink(string nodeId)
|
||||
{
|
||||
_nodeId = nodeId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a log entry to the in-memory sink.
|
||||
/// </summary>
|
||||
/// <param name="category">The log category.</param>
|
||||
/// <param name="level">The log level.</param>
|
||||
/// <param name="message">The formatted log message.</param>
|
||||
/// <param name="exception">The optional exception associated with the log entry.</param>
|
||||
public void Add(string category, LogLevel level, string message, Exception? exception)
|
||||
{
|
||||
var text = $"[{DateTime.UtcNow:O}] {_nodeId} {level} {category}: {message}";
|
||||
@@ -513,6 +574,11 @@ public class ClusterCrudSyncE2ETests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the most recent log entries from the sink.
|
||||
/// </summary>
|
||||
/// <param name="max">The maximum number of entries to return.</param>
|
||||
/// <returns>A newline-delimited string of recent log entries, or a placeholder when none exist.</returns>
|
||||
public string GetRecent(int max)
|
||||
{
|
||||
var entries = _entries.ToArray();
|
||||
@@ -529,16 +595,22 @@ public class ClusterCrudSyncE2ETests
|
||||
{
|
||||
private readonly InMemoryLogSink _sink;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InMemoryLoggerProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="sink">The shared sink used to capture log messages.</param>
|
||||
public InMemoryLoggerProvider(InMemoryLogSink sink)
|
||||
{
|
||||
_sink = sink;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
{
|
||||
return new InMemoryLogger(categoryName, _sink);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
@@ -549,22 +621,30 @@ public class ClusterCrudSyncE2ETests
|
||||
private readonly string _categoryName;
|
||||
private readonly InMemoryLogSink _sink;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InMemoryLogger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="categoryName">The logger category name.</param>
|
||||
/// <param name="sink">The sink that stores emitted log messages.</param>
|
||||
public InMemoryLogger(string categoryName, InMemoryLogSink sink)
|
||||
{
|
||||
_categoryName = categoryName;
|
||||
_sink = sink;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IDisposable BeginScope<TState>(TState state) where TState : notnull
|
||||
{
|
||||
return NullScope.Instance;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Log<TState>(
|
||||
LogLevel logLevel,
|
||||
EventId eventId,
|
||||
@@ -580,6 +660,7 @@ public class ClusterCrudSyncE2ETests
|
||||
{
|
||||
public static readonly NullScope Instance = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user