Skip to content

Commit

Permalink
RavenDB-21392 : address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aviv86 committed Nov 20, 2023
1 parent 2b49e8c commit 0afcb75
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions test/SlowTests/Issues/RavenDB-15330.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Raven.Client.Util;
using Raven.Server.Config;
using Raven.Server.Rachis;
using Raven.Server.ServerWide.Commands.Indexes;
using Raven.Server.ServerWide.Context;
using Tests.Infrastructure;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -20,26 +17,18 @@ public RavenDB_15330(ITestOutputHelper output) : base(output)
[Fact]
public async Task Command_With_DontCareId_Should_Be_Committed()
{
var server = GetNewServer();
using var store = GetDocumentStoreForRollingIndexes(new Options
{
ModifyDatabaseRecord =
record => record.Settings[RavenConfiguration.GetKey(x => x.Indexing.MaxTimeToWaitAfterFlushAndSyncWhenReplacingSideBySideIndex)] = "5",
Server = server,
ReplicationFactor = 1,
Server = Server
});

await server.ServerStore.SendToLeaderAsync(new PutRollingIndexCommand(store.Database, "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 = historyLog.Any(djv => djv[nameof(RachisLogHistory.LogHistoryColumn.Type)]?.ToString() == nameof(PutRollingIndexCommand) &&
djv[nameof(RachisLogHistory.LogHistoryColumn.State)]?.ToString() == "Committed");
Assert.True(contain);
}
await Cluster.WaitForRaftCommandToBeAppliedInLocalServerAsync(nameof(PutRollingIndexCommand));
}
}

0 comments on commit 0afcb75

Please sign in to comment.