diff --git a/test/Kurrent.Client.Tests.Common/Fixtures/KurrentPermanentFixture.cs b/test/Kurrent.Client.Tests.Common/Fixtures/KurrentPermanentFixture.cs index c70fa8360..0b657b61f 100644 --- a/test/Kurrent.Client.Tests.Common/Fixtures/KurrentPermanentFixture.cs +++ b/test/Kurrent.Client.Tests.Common/Fixtures/KurrentPermanentFixture.cs @@ -95,14 +95,14 @@ public async Task InitializeAsync() { Logger.Warning("*** Warmup started ***"); await Task.WhenAll( - InitClient(async x => Users = await x.WarmUp()), - InitClient(async x => Streams = await x.WarmUp()), + InitClient(async x => Users = await Task.FromResult(x)), + InitClient(async x => Streams = await Task.FromResult(x)), InitClient( - async x => Projections = await x.WarmUp(), + async x => Projections = await Task.FromResult(x), Options.Environment["EVENTSTORE_RUN_PROJECTIONS"] != "None" ), - InitClient(async x => Subscriptions = SkipPsWarmUp ? x : await x.WarmUp()), - InitClient(async x => Operations = await x.WarmUp()) + InitClient(async x => Subscriptions = SkipPsWarmUp ? x : await Task.FromResult(x)), + InitClient(async x => Operations = await Task.FromResult(x)) ); WarmUpCompleted.EnsureCalledOnce(); diff --git a/test/Kurrent.Client.Tests.Common/Fixtures/KurrentTemporaryFixture.cs b/test/Kurrent.Client.Tests.Common/Fixtures/KurrentTemporaryFixture.cs index 4cea1be60..8a71891ca 100644 --- a/test/Kurrent.Client.Tests.Common/Fixtures/KurrentTemporaryFixture.cs +++ b/test/Kurrent.Client.Tests.Common/Fixtures/KurrentTemporaryFixture.cs @@ -96,14 +96,14 @@ public async Task InitializeAsync() { Logger.Warning("*** Warmup started ***"); await Task.WhenAll( - InitClient(async x => Users = await x.WarmUp()), - InitClient(async x => Streams = await x.WarmUp()), + InitClient(async x => Users = await Task.FromResult(x)), + InitClient(async x => Streams = await Task.FromResult(x)), InitClient( - async x => Projections = await x.WarmUp(), + async x => Projections = await Task.FromResult(x), Options.Environment["EVENTSTORE_RUN_PROJECTIONS"] != "None" ), - InitClient(async x => Subscriptions = SkipPsWarmUp ? x : await x.WarmUp()), - InitClient(async x => Operations = await x.WarmUp()) + InitClient(async x => Subscriptions = SkipPsWarmUp ? x : await Task.FromResult(x)), + InitClient(async x => Operations = await Task.FromResult(x)) ); WarmUpCompleted.EnsureCalledOnce(); diff --git a/test/Kurrent.Client.Tests/PersistentSubscriptions/SubscribeToAll/Obsolete/SubscribeToAllObsoleteTests.cs b/test/Kurrent.Client.Tests/PersistentSubscriptions/SubscribeToAll/Obsolete/SubscribeToAllObsoleteTests.cs index 957b42c69..05dc4baff 100644 --- a/test/Kurrent.Client.Tests/PersistentSubscriptions/SubscribeToAll/Obsolete/SubscribeToAllObsoleteTests.cs +++ b/test/Kurrent.Client.Tests/PersistentSubscriptions/SubscribeToAll/Obsolete/SubscribeToAllObsoleteTests.cs @@ -303,95 +303,95 @@ public async Task deleting_existing_with_subscriber() { Assert.Equal(group, ex.GroupName); } - [RetryFact] - public async Task happy_case_catching_up_to_link_to_events_manual_ack() { - var group = Fixture.GetGroupName(); - var bufferCount = 10; - var eventWriteCount = bufferCount * 2; - TaskCompletionSource eventsReceived = new(); - int eventReceivedCount = 0; - - var events = Fixture.CreateTestEvents(eventWriteCount) - .Select( - (e, i) => new EventData( - e.EventId, - SystemEventTypes.LinkTo, - Encoding.UTF8.GetBytes($"{i}@test"), - contentType: Constants.Metadata.ContentTypes.ApplicationOctetStream - ) - ) - .ToArray(); - - foreach (var e in events) { - await Fixture.Streams.AppendToStreamAsync("test-" + Guid.NewGuid(), StreamState.Any, new[] { e }); - } - - await Fixture.Subscriptions.CreateToAllAsync( - group, - new(startFrom: Position.Start, resolveLinkTos: true), - userCredentials: TestCredentials.Root - ); - - using var subscription = await Fixture.Subscriptions.SubscribeToAllAsync( - group, - async (subscription, e, retryCount, ct) => { - await subscription.Ack(e); - - if (e.OriginalStreamId.StartsWith("test-") - && Interlocked.Increment(ref eventReceivedCount) == events.Length) - eventsReceived.TrySetResult(true); - }, - (s, r, e) => { - if (e != null) - eventsReceived.TrySetException(e); - }, - bufferSize: bufferCount, - userCredentials: TestCredentials.Root - ); - - await eventsReceived.Task.WithTimeout(); - } - - [RetryFact] - public async Task happy_case_catching_up_to_normal_events_manual_ack() { - var group = Fixture.GetGroupName(); - var stream = Fixture.GetStreamName(); - var bufferCount = 10; - var eventWriteCount = bufferCount * 2; - int eventReceivedCount = 0; - - TaskCompletionSource eventsReceived = new(); - - var events = Fixture.CreateTestEvents(eventWriteCount).ToArray(); - - foreach (var e in events) - await Fixture.Streams.AppendToStreamAsync(stream, StreamState.Any, [e]); - - await Fixture.Subscriptions.CreateToAllAsync( - group, - new(startFrom: Position.Start, resolveLinkTos: true), - userCredentials: TestCredentials.Root - ); - - using var subscription = await Fixture.Subscriptions.SubscribeToAllAsync( - group, - async (subscription, e, retryCount, ct) => { - await subscription.Ack(e); - - if (e.OriginalStreamId.StartsWith("test-") - && Interlocked.Increment(ref eventReceivedCount) == events.Length) - eventsReceived.TrySetResult(true); - }, - (s, r, e) => { - if (e != null) - eventsReceived.TrySetException(e); - }, - bufferSize: bufferCount, - userCredentials: TestCredentials.Root - ); - - await eventsReceived.Task.WithTimeout(); - } + // [RetryFact] + // public async Task happy_case_catching_up_to_link_to_events_manual_ack() { + // var group = Fixture.GetGroupName(); + // var bufferCount = 10; + // var eventWriteCount = bufferCount * 2; + // TaskCompletionSource eventsReceived = new(); + // int eventReceivedCount = 0; + // + // var events = Fixture.CreateTestEvents(eventWriteCount) + // .Select( + // (e, i) => new EventData( + // e.EventId, + // SystemEventTypes.LinkTo, + // Encoding.UTF8.GetBytes($"{i}@test"), + // contentType: Constants.Metadata.ContentTypes.ApplicationOctetStream + // ) + // ) + // .ToArray(); + // + // foreach (var e in events) { + // await Fixture.Streams.AppendToStreamAsync("test-" + Guid.NewGuid(), StreamState.Any, new[] { e }); + // } + // + // await Fixture.Subscriptions.CreateToAllAsync( + // group, + // new(startFrom: Position.Start, resolveLinkTos: true), + // userCredentials: TestCredentials.Root + // ); + // + // using var subscription = await Fixture.Subscriptions.SubscribeToAllAsync( + // group, + // async (subscription, e, retryCount, ct) => { + // await subscription.Ack(e); + // + // if (e.OriginalStreamId.StartsWith("test-") + // && Interlocked.Increment(ref eventReceivedCount) == events.Length) + // eventsReceived.TrySetResult(true); + // }, + // (s, r, e) => { + // if (e != null) + // eventsReceived.TrySetException(e); + // }, + // bufferSize: bufferCount, + // userCredentials: TestCredentials.Root + // ); + // + // await eventsReceived.Task.WithTimeout(); + // } + // + // [RetryFact] + // public async Task happy_case_catching_up_to_normal_events_manual_ack() { + // var group = Fixture.GetGroupName(); + // var stream = Fixture.GetStreamName(); + // var bufferCount = 10; + // var eventWriteCount = bufferCount * 2; + // int eventReceivedCount = 0; + // + // TaskCompletionSource eventsReceived = new(); + // + // var events = Fixture.CreateTestEvents(eventWriteCount).ToArray(); + // + // foreach (var e in events) + // await Fixture.Streams.AppendToStreamAsync(stream, StreamState.Any, [e]); + // + // await Fixture.Subscriptions.CreateToAllAsync( + // group, + // new(startFrom: Position.Start, resolveLinkTos: true), + // userCredentials: TestCredentials.Root + // ); + // + // using var subscription = await Fixture.Subscriptions.SubscribeToAllAsync( + // group, + // async (subscription, e, retryCount, ct) => { + // await subscription.Ack(e); + // + // if (e.OriginalStreamId.StartsWith("test-") + // && Interlocked.Increment(ref eventReceivedCount) == events.Length) + // eventsReceived.TrySetResult(true); + // }, + // (s, r, e) => { + // if (e != null) + // eventsReceived.TrySetException(e); + // }, + // bufferSize: bufferCount, + // userCredentials: TestCredentials.Root + // ); + // + // await eventsReceived.Task.WithTimeout(); + // } [RetryFact] public async Task happy_case_writing_and_subscribing_to_normal_events_manual_ack() {