diff --git a/test/SlowTests/Issues/RavenDB-15330.cs b/test/SlowTests/Issues/RavenDB-15330.cs index 00ee837fa9f1..64d1bfdae56c 100644 --- a/test/SlowTests/Issues/RavenDB-15330.cs +++ b/test/SlowTests/Issues/RavenDB-15330.cs @@ -1,24 +1,11 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading; using System.Threading.Tasks; -using FastTests; -using FastTests.Server.Replication; -using Orders; -using Raven.Client.Documents.Indexes; using Raven.Client.Util; using Raven.Server.Config; -using Raven.Server.Documents.Indexes.Static; using Raven.Server.Rachis; -using Raven.Server.ServerWide; using Raven.Server.ServerWide.Commands.Indexes; -using Raven.Server.ServerWide.Commands.Subscriptions; using Raven.Server.ServerWide.Context; -using Raven.Server.Utils; -using SlowTests.Rolling; -using Sparrow.Json.Parsing; using Tests.Infrastructure; using Xunit; using Xunit.Abstractions; @@ -33,12 +20,8 @@ public RavenDB_15330(ITestOutputHelper output) : base(output) [Fact] public async Task Command_With_DontCareId_Should_Be_Committed() { - var typeProp = nameof(RachisLogHistory.LogHistoryColumn.Type); - var stateProp = nameof(RachisLogHistory.LogHistoryColumn.State); - var indexProp = nameof(RachisLogHistory.LogHistoryColumn.Index); - var server = GetNewServer(); - using var store = GetDocumentStoreForRollingIndexes(new RavenTestBase.Options + using var store = GetDocumentStoreForRollingIndexes(new Options { ModifyDatabaseRecord = record => record.Settings[RavenConfiguration.GetKey(x => x.Indexing.MaxTimeToWaitAfterFlushAndSyncWhenReplacingSideBySideIndex)] = "5", @@ -46,56 +29,17 @@ record => record.Settings[RavenConfiguration.GetKey(x => x.Indexing.MaxTimeToWai ReplicationFactor = 1, }); - await store.ExecuteIndexAsync(new SomeRollingIndex()); - - var result = await server.ServerStore.SendToLeaderAsync(new PutRollingIndexCommand(store.Database, nameof(SomeRollingIndex), + await server.ServerStore.SendToLeaderAsync(new PutRollingIndexCommand(store.Database, "SomeRollingIndex", DateTime.UtcNow, RaftIdGenerator.DontCareId)); using (server.ServerStore.Engine.ContextPool.AllocateOperationContext(out ClusterOperationContext context)) using (context.OpenReadTransaction()) { var historyLog = server.ServerStore.Engine.LogHistory.GetHistoryLogs(context); - bool contain = false; - bool first = true; - long lastIndex = 0; - foreach (var djv in historyLog) - { - if (first) - { - lastIndex = long.Parse(djv[indexProp].ToString()); - first = false; - } - else - { - var currentIndex = long.Parse(djv[indexProp].ToString()); - Assert.Equal(lastIndex+1, currentIndex); - lastIndex = currentIndex; - } - - if (djv[typeProp] != null && djv[typeProp].ToString() == nameof(PutRollingIndexCommand) && - djv[stateProp] !=null && djv[stateProp].ToString() == "Committed") - { - contain = true; - break; - } - } + bool contain = historyLog.Any(djv => djv[nameof(RachisLogHistory.LogHistoryColumn.Type)]?.ToString() == nameof(PutRollingIndexCommand) && + djv[nameof(RachisLogHistory.LogHistoryColumn.State)]?.ToString() == "Committed"); Assert.True(contain); } } - - private class SomeRollingIndex : AbstractIndexCreationTask - { - public SomeRollingIndex() - { - Map = orders => from order in orders - select new - { - order.Company, - }; - - DeploymentMode = IndexDeploymentMode.Rolling; - } - } - }