Skip to content

Commit

Permalink
Merge pull request #1 from grooverdan/mariadbpr
Browse files Browse the repository at this point in the history
Add MariaDB tests by extended the MySQL class
  • Loading branch information
grooverdan committed Jun 18, 2024
2 parents 52160dc + 0eaccea commit 46a7ae2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jobs:
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
mariadb:
image: mariadb
ports:
- 3307:3306/tcp
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: test
options: --health-cmd "healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v1
Expand All @@ -49,5 +57,6 @@ jobs:
OLEDBConnectionString: Provider=SQLOLEDB;Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
PostgesConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
SqlServerConnectionString: Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
MariaDBConnectionString: Server=localhost;Port=${{ job.services.mariadb.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true
- name: .NET Lib Pack
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
14 changes: 14 additions & 0 deletions tests/Dapper.Tests/Providers/MariaDBTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Dapper.Tests
{
/// <summary>
/// If Docker Desktop is installed, run the following command to start a container suitable for the tests.
/// <code>
/// docker run -d -p 3306:3306 --name Dapper.Tests.MariaDB -e MARIADB_DATABASE=tests -e MARIADB_USER=test -e MARIADB_PASSWORD=pass -e MARIADB_ROOT_PASSWORD=pass mariadb
/// </code>
/// </summary>
public sealed class MariaDBProvider : MySqlProvider
{
public override string GetConnectionString() =>
GetConnectionString("MariaDBConnectionString", "Server=localhost;Database=tests;Uid=test;Pwd=pass;");
}
}
2 changes: 1 addition & 1 deletion tests/Dapper.Tests/Providers/MySQLTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Dapper.Tests
/// docker run -d -p 3306:3306 --name Dapper.Tests.MySQL -e MYSQL_DATABASE=tests -e MYSQL_USER=test -e MYSQL_PASSWORD=pass -e MYSQL_ROOT_PASSWORD=pass mysql
/// </code>
/// </summary>
public sealed class MySqlProvider : DatabaseProvider
public class MySqlProvider : DatabaseProvider
{
public override DbProviderFactory Factory => MySqlConnector.MySqlConnectorFactory.Instance;
public override string GetConnectionString() =>
Expand Down

0 comments on commit 46a7ae2

Please sign in to comment.