8000 add SSL tests to travis · mysql-net/MySqlConnector@a82a661 · GitHub
[go: up one dir, main page]

Skip to content

Commit a82a661

Browse files
committed
add SSL tests to travis
1 parent 0e4c0c7 commit a82a661

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

.ci/config.ssl.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"Data": {
3+
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;certificate file=.ci/ssl-client.pfx;Use Affected Rows=true",
4+
"PasswordlessUser": "no_password",
5+
"SupportsJson": true
6+
}
7+
}

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ before_install:
88
- sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
99
- sudo apt-get update
1010
- sudo apt-get install -y dotnet-dev-1.0.0-preview2-003121
11-
- cp tests/SideBySide.New/config.json.example tests/SideBySide.New/config.json
1211

1312
script:
1413
- dotnet restore
1514
- dotnet test tests/MySqlConnector.Tests --configuration Release
16-
- dotnet test tests/SideBySide.New --configuration Release
15+
- echo 'Executing tests with ssl mode=none' && cp tests/SideBySide.New/config.json.example tests/SideBySide.New/config.json && dotnet test tests/SideBySide.New --configuration Release
16+
- echo 'Executing tests with ssl mode=required' && cp .ci/config.ssl.json tests/SideBySide.New/config.json && dotnet test tests/SideBySide.New --configuration Release
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Data": {
3+
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;certificate file=../../.ci/ssl-client.pfx;"
4+
}
5+
}

tests/SideBySide.New/ConnectSync.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Net;
66
using System.Net.Sockets;
77
using System.Text;
8+
using System.Text.RegularExpressions;
89
using System.Threading;
910
using System.Threading.Tasks;
1011
using MySql.Data.MySqlClient;
@@ -70,7 +71,7 @@ public void PersistSecurityInfo(bool persistSecurityInfo)
7071
{
7172
var csb = AppConfig.CreateConnectionStringBuilder();
7273
csb.PersistSecurityInfo = persistSecurityInfo;
73-
var connectionStringWithoutPassword = csb.ConnectionString.Replace("Password", "password").Replace(";password='" + csb.Password + "'", "");
74+
var connectionStringWithoutPassword = Regex.Replace(csb.ConnectionString, @"(?i)password='?" + Regex.Escape(csb.Password) + "'?;?", "");
7475

7576
using (var connection = new MySqlConnection(csb.ConnectionString))
7677
{

0 commit comments

Comments
 (0)
0