-
-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial logic to configure and add partitioning for archiving events
- Loading branch information
1 parent
fe9eed1
commit 624360d
Showing
9 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/EventSourcingTests/building_events_and_streams_table_based_on_partitioning.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Linq; | ||
using Marten; | ||
using Marten.Events; | ||
using Marten.Events.Archiving; | ||
using Marten.Events.Schema; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
using Weasel.Postgresql.Tables.Partitioning; | ||
using Xunit; | ||
|
||
namespace EventSourcingTests; | ||
|
||
public class building_events_and_streams_table_based_on_partitioning | ||
{ | ||
private readonly EventGraph theGraph = new EventGraph(new StoreOptions()); | ||
|
||
[Fact] | ||
public void no_partitioning_by_default() | ||
{ | ||
new EventsTable(theGraph).Partitioning.ShouldBeNull(); | ||
new StreamsTable(theGraph).Partitioning.ShouldBeNull(); | ||
} | ||
|
||
[Fact] | ||
public void events_table_build_partitioning_when_active() | ||
{ | ||
theGraph.UseArchivedStreamPartitioning = true; | ||
|
||
var table = new EventsTable(theGraph); | ||
var partitioning = table.Partitioning.ShouldBeOfType<ListPartitioning>(); | ||
partitioning.Columns.Single().ShouldBe(IsArchivedColumn.ColumnName); | ||
partitioning.Partitions.Single().ShouldBe(new ListPartition("archived", "TRUE")); | ||
|
||
table.PrimaryKeyColumns.ShouldContain(IsArchivedColumn.ColumnName); | ||
} | ||
|
||
[Fact] | ||
public void streams_table_build_partitioning_when_active() | ||
{ | ||
theGraph.UseArchivedStreamPartitioning = true; | ||
|
||
var table = new StreamsTable(theGraph); | ||
var partitioning = table.Partitioning.ShouldBeOfType<ListPartitioning>(); | ||
partitioning.Columns.Single().ShouldBe(IsArchivedColumn.ColumnName); | ||
partitioning.Partitions.Single().ShouldBe(new ListPartition("archived", "TRUE")); | ||
|
||
table.PrimaryKeyColumns.ShouldContain(IsArchivedColumn.ColumnName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters