Skip to content

Commit 46a7ae2

Browse files
authored
Merge pull request #1 from grooverdan/mariadbpr
Add MariaDB tests by extended the MySQL class
2 parents 52160dc + 0eaccea commit 46a7ae2

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737
env:
3838
MYSQL_ROOT_PASSWORD: root
3939
MYSQL_DATABASE: test
40+
mariadb:
41+
image: mariadb
42+
ports:
43+
- 3307:3306/tcp
44+
env:
45+
MARIADB_ROOT_PASSWORD: root
46+
MARIADB_DATABASE: test
47+
options: --health-cmd "healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5
4048
steps:
4149
- name: Checkout code
4250
uses: actions/checkout@v1
@@ -49,5 +57,6 @@ jobs:
4957
OLEDBConnectionString: Provider=SQLOLEDB;Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
5058
PostgesConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
5159
SqlServerConnectionString: Server=tcp:localhost,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=Password.;
60+
MariaDBConnectionString: Server=localhost;Port=${{ job.services.mariadb.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true
5261
- name: .NET Lib Pack
5362
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Dapper.Tests
2+
{
3+
/// <summary>
4+
/// If Docker Desktop is installed, run the following command to start a container suitable for the tests.
5+
/// <code>
6+
/// 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
7+
/// </code>
8+
/// </summary>
9+
public sealed class MariaDBProvider : MySqlProvider
10+
{
11+
public override string GetConnectionString() =>
12+
GetConnectionString("MariaDBConnectionString", "Server=localhost;Database=tests;Uid=test;Pwd=pass;");
13+
}
14+
}

tests/Dapper.Tests/Providers/MySQLTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Dapper.Tests
1313
/// 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
1414
/// </code>
1515
/// </summary>
16-
public sealed class MySqlProvider : DatabaseProvider
16+
public class MySqlProvider : DatabaseProvider
1717
{
1818
public override DbProviderFactory Factory => MySqlConnector.MySqlConnectorFactory.Instance;
1919
public override string GetConnectionString() =>

0 commit comments

Comments
 (0)