-
Notifications
You must be signed in to change notification settings - Fork 694
fix(snap-sync): three Windows-flake fixes for E2ESyncTests.SnapSync #11443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
edc0d3d
c14030d
12a66f1
73b160f
41e858d
91db203
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -408,15 +408,31 @@ public async Task SnapSync() | |
| if (dbMode == DbMode.Hash) Assert.Ignore("Hash db does not support snap sync"); | ||
|
|
||
| using CancellationTokenSource cancellationTokenSource = new CancellationTokenSource().ThatCancelAfter(TestTimeout); | ||
| await RunSnapSyncOnce(cancellationTokenSource.Token); | ||
| } | ||
|
|
||
| // Stress reproducer for SnapSync Windows flake — run manually; see PR #11443 for context. | ||
| [Test, Explicit("Stress reproducer for SnapSync Windows flake — run manually")] | ||
| [TestCaseSource(nameof(StressIterations))] | ||
| public async Task SnapSync_StressRepro(int iteration) | ||
| { | ||
| if (dbMode != DbMode.Flat) Assert.Ignore("Stress repro only targets the Flat dbMode where the flake was observed"); | ||
| _ = iteration; // index is purely to give NUnit a unique case per attempt | ||
|
|
||
| using CancellationTokenSource cancellationTokenSource = new CancellationTokenSource().ThatCancelAfter(TestTimeout); | ||
| await RunSnapSyncOnce(cancellationTokenSource.Token); | ||
| } | ||
|
|
||
| private async Task RunSnapSyncOnce(CancellationToken cancellationToken) | ||
| { | ||
| PrivateKey clientKey = TestItem.PrivateKeyD; | ||
| await using IContainer client = await CreateNode(clientKey, async (cfg, spec) => | ||
| { | ||
| SyncConfig syncConfig = (SyncConfig)cfg.GetConfig<ISyncConfig>(); | ||
| syncConfig.FastSync = true; | ||
| syncConfig.SnapSync = true; | ||
|
|
||
| await SetPivot(syncConfig, cancellationTokenSource.Token); | ||
| await SetPivot(syncConfig, cancellationToken); | ||
|
|
||
| INetworkConfig networkConfig = cfg.GetConfig<INetworkConfig>(); | ||
| networkConfig.P2PPort = AllocatePort(); | ||
|
|
@@ -425,9 +441,12 @@ public async Task SnapSync() | |
| networkConfig.FilterDiscoveryNodesByRecentIp = false; | ||
| }); | ||
|
|
||
| await client.Resolve<SyncTestContext>().SyncFromServer(_server, cancellationTokenSource.Token); | ||
| await client.Resolve<SyncTestContext>().SyncFromServer(_server, cancellationToken); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still a verbatim copy of private async Task RunSnapSyncOnce(CancellationToken cancellationToken)
{
PrivateKey clientKey = TestItem.PrivateKeyD;
await using IContainer client = await CreateNode(clientKey, async (cfg, spec) =>
{
SyncConfig syncConfig = (SyncConfig)cfg.GetConfig<ISyncConfig>();
syncConfig.FastSync = true;
syncConfig.SnapSync = true;
await SetPivot(syncConfig, cancellationToken);
INetworkConfig networkConfig = cfg.GetConfig<INetworkConfig>();
networkConfig.P2PPort = AllocatePort();
networkConfig.FilterPeersByRecentIp = false;
networkConfig.FilterDiscoveryNodesByRecentIp = false;
});
await client.Resolve<SyncTestContext>().SyncFromServer(_server, cancellationToken);
}Then both tests become: await RunSnapSyncOnce(cancellationTokenSource.Token);
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Medium (third occurrence — unaddressed): Lines 447–462 are still a verbatim copy of private async Task RunSnapSyncOnce(CancellationToken cancellationToken)
{
PrivateKey clientKey = TestItem.PrivateKeyD;
await using IContainer client = await CreateNode(clientKey, async (cfg, spec) =>
{
SyncConfig syncConfig = (SyncConfig)cfg.GetConfig<ISyncConfig>();
syncConfig.FastSync = true;
syncConfig.SnapSync = true;
await SetPivot(syncConfig, cancellationToken);
INetworkConfig networkConfig = cfg.GetConfig<INetworkConfig>();
networkConfig.P2PPort = AllocatePort();
networkConfig.FilterPeersByRecentIp = false;
networkConfig.FilterDiscoveryNodesByRecentIp = false;
});
await client.Resolve<SyncTestContext>().SyncFromServer(_server, cancellationToken);
}Both |
||
|
|
||
| private const int StressIterationCount = 30; | ||
| private static IEnumerable<int> StressIterations() => Enumerable.Range(0, StressIterationCount); | ||
|
|
||
| [Test] | ||
| [Retry(5)] | ||
| public async Task SnapSync_HalfPathServer_HashClient() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body of this test is a verbatim copy of
SnapSync(). Per the repo's test-infrastructure rules, duplicating test method bodies is not allowed — extract the shared logic into a private helper (e.g.RunSnapSyncClientOnce(CancellationToken)) and have both methods call it.