-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add xUnit 2.5.1 compatibility (#324)
- Loading branch information
Showing
12 changed files
with
336 additions
and
196 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/Akka.Persistence.Sql.Benchmark.Tests/MySql/MySqlJournalPerfSpec.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,51 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="SqlServerJournalPerfSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Configuration; | ||
using Akka.Persistence.MySql; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Akka.Persistence.SqlServer; | ||
using FluentAssertions.Extensions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Akka.Persistence.Sql.Benchmark.Tests.MySql | ||
{ | ||
[Collection(nameof(MySqlPersistenceBenchmark))] | ||
public class MySqlJournalPerfSpec : SqlJournalPerfSpec<MySqlContainer> | ||
{ | ||
public MySqlJournalPerfSpec(ITestOutputHelper output, MySqlContainer fixture) | ||
: base( | ||
Configuration(fixture), | ||
nameof(MySqlJournalPerfSpec), | ||
output, | ||
40, | ||
eventsCount: TestConstants.DockerNumMessages) { } | ||
|
||
private static Configuration.Config Configuration(MySqlContainer fixture) | ||
{ | ||
if (!fixture.InitializeDbAsync().Wait(10.Seconds())) | ||
throw new Exception("Failed to clean up database in 10 seconds"); | ||
|
||
return ConfigurationFactory.ParseString( | ||
$$""" | ||
akka.persistence { | ||
publish-plugin-commands = on | ||
journal { | ||
plugin = "akka.persistence.journal.mysql" | ||
mysql { | ||
auto-initialize = on | ||
connection-string = "{{fixture.ConnectionString}}" | ||
} | ||
} | ||
} | ||
""") | ||
.WithFallback(Persistence.DefaultConfig()) | ||
.WithFallback(MySqlPersistence.DefaultConfiguration()); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Akka.Persistence.Sql.Benchmark.Tests/MySql/MySqlLinq2DbJournalPerfSpec.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,60 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="SqlServerLinq2DbJournalPerfSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Akka.Configuration; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using FluentAssertions.Extensions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Akka.Persistence.Sql.Benchmark.Tests.MySql | ||
{ | ||
[Collection(nameof(MySqlPersistenceBenchmark))] | ||
public class MySqlLinq2DbJournalPerfSpec : SqlJournalPerfSpec<MySqlContainer> | ||
{ | ||
public MySqlLinq2DbJournalPerfSpec(ITestOutputHelper output, MySqlContainer fixture) | ||
: base( | ||
Configure(fixture), | ||
nameof(MySqlLinq2DbJournalPerfSpec), | ||
output, | ||
40, | ||
eventsCount: TestConstants.DockerNumMessages) { } | ||
|
||
private static Configuration.Config Configure(MySqlContainer fixture) | ||
{ | ||
if (!fixture.InitializeDbAsync().Wait(10.Seconds())) | ||
throw new Exception("Failed to clean up database in 10 seconds"); | ||
|
||
return ConfigurationFactory.ParseString( | ||
@$" | ||
akka.persistence {{ | ||
publish-plugin-commands = on | ||
journal {{ | ||
plugin = ""akka.persistence.journal.sql"" | ||
sql {{ | ||
connection-string = ""{fixture.ConnectionString}"" | ||
provider-name = ""{fixture.ProviderName}"" | ||
use-clone-connection = true | ||
auto-initialize = true | ||
default {{ | ||
journal {{ | ||
table-name = testPerfTable | ||
}} | ||
}} | ||
}} | ||
}} | ||
}}") | ||
.WithFallback(Persistence.DefaultConfig()) | ||
.WithFallback(SqlPersistence.DefaultConfiguration); | ||
} | ||
|
||
[Fact] | ||
public async Task PersistenceActor_Must_measure_PersistGroup1000() | ||
=> await RunGroupBenchmarkAsync(1000, 10); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Akka.Persistence.Sql.Benchmark.Tests/MySql/MySqlPersistenceBenchmark.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,15 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="SqlServerPersistenceBenchmark.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using Akka.Persistence.Sql.Benchmark.Tests.SqlServer; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Xunit; | ||
|
||
namespace Akka.Persistence.Sql.Benchmark.Tests.MySql | ||
{ | ||
[CollectionDefinition(nameof(MySqlPersistenceBenchmark), DisableParallelization = true)] | ||
public sealed class MySqlPersistenceBenchmark : ICollectionFixture<MySqlContainer> { } | ||
} |
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
Oops, something went wrong.