From 5d208b61ce588f1195fd5803812a556f73aef409 Mon Sep 17 00:00:00 2001 From: aviv Date: Sun, 14 Jul 2024 18:27:18 +0300 Subject: [PATCH] RavenDB-22583 : fix failing resharding test - increase timeout for big bucket migration --- test/SlowTests/Sharding/PrefixedSharding.cs | 2 +- .../RavenTestBase.ReshardingTestBase.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/SlowTests/Sharding/PrefixedSharding.cs b/test/SlowTests/Sharding/PrefixedSharding.cs index 4f4f35a0a79..c97672be72b 100644 --- a/test/SlowTests/Sharding/PrefixedSharding.cs +++ b/test/SlowTests/Sharding/PrefixedSharding.cs @@ -1633,7 +1633,7 @@ await store.Maintenance.SendAsync(new UpdatePrefixedShardingSettingOperation(new })); // move big bucket to the newly added shard - await Sharding.Resharding.MoveShardForId(store, $"users/0${bigBucketId}", toShard: 2); + await Sharding.Resharding.MoveShardForId(store, $"users/0${bigBucketId}", toShard: 2, timeout: 90_000); // assert stats using (shard.DocumentsStorage.ContextPool.AllocateOperationContext(out DocumentsOperationContext ctx)) diff --git a/test/Tests.Infrastructure/RavenTestBase.ReshardingTestBase.cs b/test/Tests.Infrastructure/RavenTestBase.ReshardingTestBase.cs index 236d6ce5e60..344def377b8 100644 --- a/test/Tests.Infrastructure/RavenTestBase.ReshardingTestBase.cs +++ b/test/Tests.Infrastructure/RavenTestBase.ReshardingTestBase.cs @@ -81,9 +81,9 @@ public async Task StartMovingShardForId(IDocumentStore store, string id, in return bucket; } - public async Task WaitForMigrationComplete(IDocumentStore store, int bucket) + public async Task WaitForMigrationComplete(IDocumentStore store, int bucket, int timeout = 30_000) { - using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30))) + using (var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(timeout))) { var record = await store.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation(store.Database), cts.Token); while (record.Sharding.BucketMigrations.ContainsKey(bucket)) @@ -94,13 +94,13 @@ record = await store.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation } } - public async Task MoveShardForId(IDocumentStore store, string id, int? toShard = null, List servers = null) + public async Task MoveShardForId(IDocumentStore store, string id, int? toShard = null, List servers = null, int timeout = 30_000) { try { servers ??= _parent.GetServers(); var bucket = await StartMovingShardForId(store, id, toShard, servers); - await WaitForMigrationComplete(store, bucket); + await WaitForMigrationComplete(store, bucket, timeout); } catch (Exception e) {