From 61593d8e4cffd7b3a1d7b974729a0c88c99994fb Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Thu, 12 Sep 2024 03:33:14 +0700 Subject: [PATCH] Add SnapshotStore SaveSnapshot spec from TCK (#271) --- ...PostgreSqlSnapshotStoreSaveSnapshotSpec.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSaveSnapshotSpec.cs diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSaveSnapshotSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSaveSnapshotSpec.cs new file mode 100644 index 0000000..48e34e0 --- /dev/null +++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSaveSnapshotSpec.cs @@ -0,0 +1,41 @@ +using Akka.Configuration; +using Akka.Persistence.TCK.Snapshot; +using Xunit; +using Xunit.Abstractions; + +namespace Akka.Persistence.PostgreSql.Tests; + +[Collection("PostgreSqlSpec")] +public class PostgreSqlSnapshotStoreSaveSnapshotSpec: SnapshotStoreSaveSnapshotSpec +{ + private static Config Initialize(PostgresFixture fixture) + { + //need to make sure db is created before the tests start + DbUtils.Initialize(fixture); + + var config = @$" + akka.persistence {{ + publish-plugin-commands = on + snapshot-store {{ + plugin = ""akka.persistence.snapshot-store.postgresql"" + postgresql {{ + class = ""Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql"" + plugin-dispatcher = ""akka.actor.default-dispatcher"" + table-name = snapshot_store + schema-name = public + auto-initialize = on + connection-string = ""{DbUtils.ConnectionString}"" + stored-as = bytea + }} + }} + }} + akka.test.single-expect-default = 10s"; + + return ConfigurationFactory.ParseString(config); + } + + public PostgreSqlSnapshotStoreSaveSnapshotSpec(ITestOutputHelper output, PostgresFixture fixture) + : base(Initialize(fixture), nameof(PostgreSqlSnapshotStoreSaveSnapshotSpec), output: output) + { + } +} \ No newline at end of file