-
Notifications
You must be signed in to change notification settings - Fork 0
chore(projections): keep maintained coverage independent of TCP #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using EventStore.ClientAPI; | ||
| using EventStore.Core.Tests; | ||
| using EventStore.Projections.Core.Services.Processing; | ||
| using EventStore.Projections.Core.Services.Processing.Checkpointing; | ||
|
|
@@ -18,38 +17,25 @@ public class with_an_existing_emitted_streams_stream<TLogFormat, TStreamId> : Sp | |
| protected ManualResetEvent _resetEvent = new ManualResetEvent(false); | ||
| private string _testStreamName = "test_stream"; | ||
| private ManualResetEvent _eventAppeared = new ManualResetEvent(false); | ||
| private EventStore.ClientAPI.SystemData.UserCredentials _credentials; | ||
|
|
||
| protected override async Task Given() | ||
| { | ||
| _credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit"); | ||
| _onDeleteStreamCompleted = () => { _resetEvent.Set(); }; | ||
|
|
||
| await base.Given(); | ||
| var sub = await _conn.SubscribeToStreamAsync(_projectionNamesBuilder.GetEmittedStreamsName(), true, (s, evnt) => | ||
| { | ||
| _eventAppeared.Set(); | ||
| return Task.CompletedTask; | ||
| }, userCredentials: _credentials); | ||
|
|
||
| _emittedStreamsTracker.TrackEmittedStream(new EmittedEvent[] { | ||
| new EmittedDataEvent( | ||
| _testStreamName, Guid.NewGuid(), "type1", true, | ||
| "data", null, CheckpointTag.FromPosition(0, 100, 50), null), | ||
| }); | ||
|
|
||
| if (!_eventAppeared.WaitOne(TimeSpan.FromSeconds(5))) | ||
| var events = await WaitForEvents(_projectionNamesBuilder.GetEmittedStreamsName(), 1); | ||
| if (events.Length != 1) | ||
| { | ||
| Assert.Fail("Timed out waiting for emitted stream event"); | ||
| } | ||
|
|
||
| sub.Unsubscribe(); | ||
|
|
||
| var emittedStreamResult = | ||
| await _conn.ReadStreamEventsForwardAsync(_projectionNamesBuilder.GetEmittedStreamsName(), 0, 1, false, | ||
| _credentials); | ||
| Assert.AreEqual(1, emittedStreamResult.Events.Length); | ||
| Assert.AreEqual(SliceReadStatus.Success, emittedStreamResult.Status); | ||
| _eventAppeared.Set(); | ||
| } | ||
|
|
||
| protected override Task When() | ||
|
|
@@ -66,25 +52,22 @@ protected override Task When() | |
| [Test] | ||
| public async Task should_have_deleted_the_tracked_emitted_stream() | ||
| { | ||
| var result = await _conn.ReadStreamEventsForwardAsync(_testStreamName, 0, 1, false, | ||
| new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit")); | ||
| Assert.AreEqual(SliceReadStatus.StreamNotFound, result.Status); | ||
| var events = await ReadEvents(_testStreamName, 1); | ||
| Assert.AreEqual(0, events.Length); | ||
|
Comment on lines
+55
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Preserve the missing-stream contract.
🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
||
| [Test] | ||
| public async Task should_have_deleted_the_checkpoint_stream() | ||
| { | ||
| var result = await _conn.ReadStreamEventsForwardAsync(_projectionNamesBuilder.GetEmittedStreamsCheckpointName(), | ||
| 0, 1, false, new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit")); | ||
| Assert.AreEqual(SliceReadStatus.StreamNotFound, result.Status); | ||
| var events = await ReadEvents(_projectionNamesBuilder.GetEmittedStreamsCheckpointName(), 1); | ||
| Assert.AreEqual(0, events.Length); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task should_have_deleted_the_emitted_streams_stream() | ||
| { | ||
| var result = await _conn.ReadStreamEventsForwardAsync(_projectionNamesBuilder.GetEmittedStreamsName(), 0, 1, | ||
| false, new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit")); | ||
| Assert.AreEqual(SliceReadStatus.StreamNotFound, result.Status); | ||
| var events = await ReadEvents(_projectionNamesBuilder.GetEmittedStreamsName(), 1); | ||
| Assert.AreEqual(0, events.Length); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.