public void should_not_be_able_to_read_event_from_stream_forward() { var readResult = ReplicationTestHelper.ReadStreamEventsForward(_liveNode, _streamId); Assert.AreEqual(1, readResult.Events.Count()); Assert.AreEqual(ReadStreamResult.Success, readResult.Result); }
public void should_be_able_to_read_event_from_stream_backward_on_master() { var readResult = ReplicationTestHelper.ReadStreamEventsBackward(GetMaster(), _streamId); Assert.AreEqual(ReadStreamResult.Success, readResult.Result); Assert.AreEqual(1, readResult.Events.Count()); }
public void should_be_able_to_read_event_from_stream_backward_on_slaves() { var slaves = GetSlaves(); var quorum = (slaves.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in slaves) { var readResult = ReplicationTestHelper.ReadStreamEventsBackward(s, _streamId); successfulReads += readResult.Events.Count(); } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_on_slaves() { var slaves = GetSlaves(); var quorum = (slaves.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in slaves) { var readResult = ReplicationTestHelper.ReadEvent(s, _streamId, 0); successfulReads += readResult.Result == ReadEventResult.Success ? 1 : 0; } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_from_all_backward_on_slaves() { var slaves = GetSlaves(); var quorum = (slaves.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in slaves) { var readResult = ReplicationTestHelper.ReadAllEventsBackward(s, _commitPosition); successfulReads += readResult.Events.Where(x => x.OriginalStreamId == _streamId).Count(); } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_on_followers() { var followers = GetFollowers(); var quorum = (followers.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in followers) { AssertEx.IsOrBecomesTrue(() => s.Db.Config.IndexCheckpoint.Read() == _indexPosition); var readResult = ReplicationTestHelper.ReadEvent(s, _streamId, 0); successfulReads += readResult.Result == ReadEventResult.Success ? 1 : 0; } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_from_all_backward_on_followers() { var followers = GetFollowers(); var quorum = (followers.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in followers) { AssertEx.IsOrBecomesTrue(() => s.Db.Config.IndexCheckpoint.Read() == _indexPosition); var readResult = ReplicationTestHelper.ReadAllEventsBackward(s, _commitPosition); successfulReads += readResult.Events.Count(x => x.OriginalStreamId == _streamId); } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_from_stream_backward_on_slaves() { var slaves = GetSlaves(); var quorum = (slaves.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in slaves) { AssertEx.IsOrBecomesTrue(() => s.Db.Config.IndexCheckpoint.Read() == _indexPosition); var readResult = ReplicationTestHelper.ReadStreamEventsBackward(s, _streamId); successfulReads += readResult.Events.Count(); } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
public void should_be_able_to_read_event_from_stream_forward_on_followers() { var followers = GetFollowers(); var quorum = (followers.Count() + 1) / 2 + 1; var successfulReads = 0; foreach (var s in followers) { AssertEx.IsOrBecomesTrue(() => s.Db.Config.IndexCheckpoint.Read() >= _indexPosition); var readResult = ReplicationTestHelper.ReadStreamEventsForward(s, _streamId); successfulReads += readResult.Events.Count(); Assert.AreEqual(ReadStreamResult.Success, readResult.Result); } Assert.GreaterOrEqual(successfulReads, quorum - 1); }
protected override async Task Given() { _expectedNumberOfRoleAssignments.Wait(5000); var master = GetMaster(); Assert.IsNotNull(master, "Could not get master node"); var events = new Event[] { new Event(Guid.NewGuid(), "test-type", false, new byte[10], new byte[0]) }; var writeResult = ReplicationTestHelper.WriteEvent(master, events, _streamId); Assert.AreEqual(OperationResult.Success, writeResult.Result); _commitPosition = writeResult.CommitPosition; // Set checkpoint to starting value master.Db.Config.ReplicationCheckpoint.Write(-1); await base.Given(); }
protected override async Task Given() { _expectedNumberOfRoleAssignments.Wait(5000); var master = GetMaster(); Assert.IsNotNull(master, "Could not get master node"); // Set the checkpoint so the check is not skipped master.Db.Config.ReplicationCheckpoint.Write(0); var events = new Event[] { new Event(Guid.NewGuid(), "test-type", false, new byte[10], new byte[0]) }; var writeResult = ReplicationTestHelper.WriteEvent(master, events, _streamId); Assert.AreEqual(OperationResult.Success, writeResult.Result); _commitPosition = writeResult.CommitPosition; Thread.Sleep(100); Assert.IsTrue(_commitPosition <= GetMaster().Db.Config.ReplicationCheckpoint.Read(), "Replication checkpoint should be greater than event commit position"); await base.Given(); }
protected override async Task Given() { _expectedNumberOfRoleAssignments.Wait(5000); _liveNode = GetLeader(); Assert.IsNotNull(_liveNode, "Could not get leader node"); var events = new Event[] { new Event(Guid.NewGuid(), "test-type", false, new byte[10], new byte[0]) }; var writeResult = ReplicationTestHelper.WriteEvent(_liveNode, events, _streamId); Assert.AreEqual(OperationResult.Success, writeResult.Result); _commitPosition = writeResult.CommitPosition; var followers = GetFollowers(); foreach (var s in followers) { await ShutdownNode(s.DebugIndex); } await base.Given(); }
public void should_be_able_to_read_event_from_all_backward_on_master() { var readResult = ReplicationTestHelper.ReadAllEventsBackward(GetMaster(), _commitPosition); Assert.AreEqual(1, readResult.Events.Where(x => x.OriginalStreamId == _streamId).Count()); }
public void should_be_able_to_read_event_from_all_forward_on_leader() { var readResult = ReplicationTestHelper.ReadAllEventsForward(GetLeader(), _commitPosition); Assert.AreEqual(1, readResult.Events.Count(x => x.OriginalStreamId == _streamId)); }
public void should_not_be_able_to_read_event() { var readResult = ReplicationTestHelper.ReadEvent(_liveNode, _streamId, 0); Assert.AreEqual(ReadEventResult.Success, readResult.Result); }
public void should_be_able_to_read_event_on_master() { var readResult = ReplicationTestHelper.ReadEvent(GetMaster(), _streamId, 0); Assert.AreEqual(ReadEventResult.Success, readResult.Result); }
public void should_be_able_to_read_event_from_all_forward() { var readResult = ReplicationTestHelper.ReadAllEventsForward(_liveNode, _commitPosition); Assert.AreEqual(1, readResult.Events.Where(x => x.OriginalStreamId == _streamId).Count()); }