Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)"/>
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion src/core/Akka.Persistence.TCK/Akka.Persistence.TCK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)"/>
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Akka.Streams.Dsl;
using Akka.Streams.TestKit;
using Akka.Util.Internal;
using FluentAssertions;
using Xunit;

namespace Akka.Persistence.TCK.Query
Expand Down Expand Up @@ -199,9 +198,9 @@ public void ReadJournal_CurrentEventsByPersistenceId_should_include_timestamp_in

var probe = src.RunWith(this.SinkProbe<EventEnvelope>(), Materializer);
probe.Request(5);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
Assert.True( probe.ExpectNext().Timestamp > 0 );
Assert.True( probe.ExpectNext().Timestamp > 0 );
Assert.True( probe.ExpectNext().Timestamp > 0 );
probe.ExpectComplete();
}

Expand Down
15 changes: 7 additions & 8 deletions src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Akka.Streams;
using Akka.Streams.TestKit;
using Akka.Streams.Dsl;
using FluentAssertions;
using Xunit;
using Xunit.Sdk;
using static Akka.Persistence.Query.Offset;
Expand Down Expand Up @@ -244,8 +243,8 @@ public virtual void ReadJournal_query_CurrentEventsByTag_should_include_timestam
var greenSrc = queries.CurrentEventsByTag("green", offset: NoOffset());
var probe = greenSrc.RunWith(this.SinkProbe<EventEnvelope>(), Materializer);
probe.Request(2);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
Assert.True( probe.ExpectNext().Timestamp > 0 );
Assert.True( probe.ExpectNext().Timestamp > 0 );
probe.Cancel();
}

Expand All @@ -267,13 +266,13 @@ private void WaitForTagEvents(ICurrentEventsByTagQuery queries, string tag, int
private EventEnvelope ExpectEnvelope(TestSubscriber.Probe<EventEnvelope> probe, string persistenceId, long sequenceNr, string @event, string tag)
{
var envelope = probe.ExpectNext<EventEnvelope>(_ => true);
envelope.PersistenceId.Should().Be(persistenceId);
envelope.SequenceNr.Should().Be(sequenceNr);
envelope.Event.Should().Be(@event);
Assert.Equal(persistenceId, envelope.PersistenceId);
Assert.Equal(sequenceNr, envelope.SequenceNr);
Assert.Equal(@event, envelope.Event);
if (SupportsTagsInEventEnvelope)
{
envelope.Tags.Should().NotBeNull();
envelope.Tags.Should().Contain(tag);
Assert.NotNull(envelope.Tags);
Assert.Contains(tag, envelope.Tags);
}
return envelope;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Akka.Streams.Dsl;
using Akka.Streams.TestKit;
using Akka.Util.Internal;
using FluentAssertions;
using Xunit;

namespace Akka.Persistence.TCK.Query
Expand Down Expand Up @@ -103,8 +102,8 @@ public void ReadJournal_live_query_EventsByPersistenceId_should_include_timestam

var probe = src.RunWith(this.SinkProbe<EventEnvelope>(), Materializer);
probe.Request(5);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
probe.ExpectNext().Timestamp.Should().BeGreaterThan(0);
Assert.True( probe.ExpectNext().Timestamp > 0 );
Assert.True( probe.ExpectNext().Timestamp > 0 );
probe.Cancel();
}

Expand Down
11 changes: 5 additions & 6 deletions src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Akka.Streams;
using Akka.Streams.TestKit;
using Akka.TestKit;
using FluentAssertions;
using Xunit;
using Xunit.Sdk;
using static Akka.Persistence.Query.Offset;
Expand Down Expand Up @@ -114,13 +113,13 @@ public virtual void ReadJournal_live_query_EventsByTag_should_find_events_from_o
private EventEnvelope ExpectEnvelope(TestSubscriber.Probe<EventEnvelope> probe, string persistenceId, long sequenceNr, string @event, string tag)
{
var envelope = probe.ExpectNext<EventEnvelope>(_ => true);
envelope.PersistenceId.Should().Be(persistenceId);
envelope.SequenceNr.Should().Be(sequenceNr);
envelope.Event.Should().Be(@event);
Assert.Equal(persistenceId, envelope.PersistenceId);
Assert.Equal(sequenceNr, envelope.SequenceNr);
Assert.Equal(@event, envelope.Event);
if (SupportsTagsInEventEnvelope)
{
envelope.Tags.Should().NotBeNull();
envelope.Tags.Should().Contain(tag);
Assert.NotNull(envelope.Tags);
Assert.Contains(tag, envelope.Tags);
}
return envelope;
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Akka.Streams.TestKit;
using Akka.TestKit;
using Akka.Util.Internal;
using FluentAssertions;
using Reactive.Streams;
using Xunit;

Expand Down Expand Up @@ -80,7 +79,7 @@ public virtual void ReadJournal_AllPersistenceIds_should_find_new_events_after_d
var expected = new List<string> { "h", "i", "j" };
probe.Within(TimeSpan.FromSeconds(10), () =>
{
expected.Remove(probe.Request(1).ExpectNext()).Should().BeTrue();
Assert.True(expected.Remove(probe.Request(1).ExpectNext()));
return probe.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Akka.Serialization;
using Xunit;
using Akka.Util.Internal;
using FluentAssertions;

#nullable enable
namespace Akka.Persistence.TCK.Serialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
using Akka.Persistence.Snapshot;
using Akka.Persistence.TCK.Serialization;
using Akka.TestKit;
using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;

namespace Akka.Persistence.TCK.Snapshot;
Expand Down Expand Up @@ -89,8 +87,8 @@ public virtual async Task MultipleSnapshotsWithNoPersistTest()
var result = await SenderProbe.ExpectMsgAsync<int[]>();
await StopActorAsync(persistenceActor);

result.Length.Should().Be(1, $"expecting an array with length 1 (on iteration {iteration}/{RepeatCount})");
result[0].Should().Be(3, $"recovered snapshot should be the last snapshot (on iteration {iteration}/{RepeatCount})");
Assert.Single(result); // expecting an array with length 1
Assert.Equal(3, result[0]); // recovered snapshot should be the last snapshot

Output.WriteLine($"Iteration: {iteration}");
}
Expand Down Expand Up @@ -124,8 +122,8 @@ public virtual async Task MultipleSnapshotsWithPersistTest()
var result = await SenderProbe.ExpectMsgAsync<int[]>();
await StopActorAsync(persistenceActor);

result.Length.Should().Be(1, $"expecting an array with length 1 (on iteration {iteration}/{RepeatCount})");
result[0].Should().Be(3, $"recovered snapshot should be the last snapshot (on iteration {iteration}/{RepeatCount})");
Assert.Single(result); // expecting an array with length 1
Assert.Equal(3, result[0]); // recovered snapshot should be the last snapshot

Output.WriteLine($"Iteration: {iteration}");
}
Expand All @@ -140,17 +138,17 @@ public virtual async Task MultipleSnapshotsWithSameSeqNo()

var metadata = new SnapshotMetadata(PersistenceId, 3, DateTime.UtcNow);
snapshotStore.Tell(new SaveSnapshot(metadata, snap), SenderProbe);
var success = await SenderProbe.ExpectMsgAsync<SaveSnapshotSuccess>(10.Minutes());
success.Metadata.PersistenceId.Should().Be(metadata.PersistenceId);
success.Metadata.Timestamp.Should().Be(metadata.Timestamp);
success.Metadata.SequenceNr.Should().Be(metadata.SequenceNr);
var success = await SenderProbe.ExpectMsgAsync<SaveSnapshotSuccess>(TimeSpan.FromMinutes(10));
Assert.Equal(success.Metadata.PersistenceId, metadata.PersistenceId);
Assert.Equal(success.Metadata.Timestamp, metadata.Timestamp);
Assert.Equal(success.Metadata.SequenceNr, metadata.SequenceNr);

metadata = new SnapshotMetadata(PersistenceId, 3, DateTime.UtcNow);
snapshotStore.Tell(new SaveSnapshot(metadata, 3), SenderProbe);
success = await SenderProbe.ExpectMsgAsync<SaveSnapshotSuccess>();
success.Metadata.PersistenceId.Should().Be(metadata.PersistenceId);
success.Metadata.Timestamp.Should().Be(metadata.Timestamp);
success.Metadata.SequenceNr.Should().Be(metadata.SequenceNr);
Assert.Equal(success.Metadata.PersistenceId, metadata.PersistenceId);
Assert.Equal(success.Metadata.Timestamp, metadata.Timestamp);
Assert.Equal(success.Metadata.SequenceNr, metadata.SequenceNr);
}

#region Utility
Expand Down
4 changes: 1 addition & 3 deletions src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
using Akka.Persistence.Fsm;
using Akka.Persistence.TCK.Serialization;
using Akka.TestKit;
using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;

namespace Akka.Persistence.TCK.Snapshot
Expand Down Expand Up @@ -234,7 +232,7 @@ public virtual void SnapshotStore_should_not_delete_snapshot_identified_by_Seque
{
var md = Metadata[2];
// timestamp argument is less than the actual metadata data stored in the database, no deletion occured
md = new SnapshotMetadata(md.PersistenceId, md.SequenceNr, md.Timestamp - 2.Seconds());
md = new SnapshotMetadata(md.PersistenceId, md.SequenceNr, md.Timestamp - TimeSpan.FromSeconds(2));
var command = new DeleteSnapshot(md);
var sub = CreateTestProbe();

Expand Down
Loading