From 0203b66faa89b5e929504ebe90b577abf9c5711c Mon Sep 17 00:00:00 2001 From: aviv Date: Mon, 19 Aug 2024 12:02:08 +0300 Subject: [PATCH] RavenDB-22634 : add test case (will be skipped for now, since there are some issues with Mixed Cluster tests) --- test/InterversionTests/RavenDB-22634.cs | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/InterversionTests/RavenDB-22634.cs diff --git a/test/InterversionTests/RavenDB-22634.cs b/test/InterversionTests/RavenDB-22634.cs new file mode 100644 index 000000000000..a30c5225dc03 --- /dev/null +++ b/test/InterversionTests/RavenDB-22634.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Raven.Client.Documents; +using Raven.Client.Exceptions; +using Raven.Client.ServerWide; +using Raven.Client.ServerWide.Operations; +using Raven.Client.ServerWide.Sharding; +using Tests.Infrastructure; +using Xunit; +using Xunit.Abstractions; + +namespace InterversionTests +{ + public class RavenDB_22634 : MixedClusterTestBase + { + public RavenDB_22634(ITestOutputHelper output) : base(output) + { + } + + [RavenMultiplatformFact(RavenTestCategory.Interversion | RavenTestCategory.Sharding, RavenPlatform.Windows, Skip = "WIP")] + public async Task MixedCluster_61_and_60_ShouldPreventCreatingDatabaseWithPrefixedSharding() + { + var (leader, peers, _) = await CreateMixedCluster([ + "6.0.105", + "6.0.105" + ]); + + using var leaderStore = new DocumentStore + { + Urls = [leader.WebUrl, peers[0].Url, peers[1].Url] + }.Initialize(); + + var dbRec = new DatabaseRecord("prefixed-db") + { + Sharding = new ShardingConfiguration + { + Shards = new Dictionary + { + {0, new DatabaseTopology()}, + {1, new DatabaseTopology()}, + {2, new DatabaseTopology()} + }, + Prefixed = [new PrefixedShardingSetting + { + Prefix = "orders/", + Shards = [2] + }] + } + }; + + var ex = await Assert.ThrowsAsync(async () => + await leaderStore.Maintenance.Server.SendAsync(new CreateDatabaseOperation(dbRec))); + + Assert.Contains("Some nodes in the cluster are running older versions of RavenDB that do not support the Prefixed Sharding feature", ex.Message); + } + } +}