Skip to content

Commit d55a1d6

Browse files
committed
add percona and mariadb to TravisCI
1 parent 9b22a2d commit d55a1d6

File tree

7 files changed

+101
-55
lines changed

7 files changed

+101
-55
lines changed

.ci/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/mysqld
2-
1+
/run

.ci/config/config.uds.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=./../../../../../.ci/mysqld/mysqld.sock;user id=mysqltest;password='test;key=\"val';database=mysqltest;ssl mode=none;Use Affected Rows=true",
3+
"ConnectionString": "server=./../../../../../.ci/run/mysql/mysqld.sock;user id=mysqltest;password='test;key=\"val';database=mysqltest;ssl mode=none;Use Affected Rows=true",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportsCachedProcedures": true,

.ci/docker-run-mysql.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

.ci/docker-run.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
cd $(dirname $0)
3+
4+
display_usage() {
5+
echo -e "\nUsage:\n$0 [image] [name] [port]\n"
6+
}
7+
8+
# check whether user had supplied -h or --help . If yes display usage
9+
if [[ ( $# == "--help") || $# == "-h" ]]
10+
then
11+
display_usage
12+
exit 0
13+
fi
14+
15+
# check number of arguments
16+
if [ $# -ne 3 ]
17+
then
18+
display_usage
19+
exit 1
20+
fi
21+
22+
IMAGE=$1
23+
NAME=$2
24+
PORT=$3
25+
26+
sudo mkdir -p run/$NAME
27+
sudo chmod 777 run/$NAME
28+
29+
docker run -d \
30+
-v $(pwd)/run/$NAME:/var/run/mysqld:rw \
31+
-v $(pwd)/server:/etc/mysql/conf.d:ro \
32+
-p $PORT:3306 \
33+
--name $NAME \
34+
-e MYSQL_ROOT_PASSWORD='test' \
35+
$IMAGE
36+
37+
for i in `seq 1 30`; do
38+
# wait for mysql to come up
39+
sleep 1
40+
# try running the init script
41+
docker exec -it $NAME bash -c 'mysql -uroot -ptest < /etc/mysql/conf.d/init.sql' >/dev/null 2>&1
42+
# exit if successful
43+
if [ $? -eq 0 ]; then
44+
docker exec -it $NAME mysql -ussltest -ptest \
45+
--ssl-mode=REQUIRED \
46+
--ssl-ca=/etc/mysql/conf.d/certs/ssl-ca-cert.pem \
47+
--ssl-cert=/etc/mysql/conf.d/certs/ssl-client-cert.pem \
48+
--ssl-key=/etc/mysql/conf.d/certs/ssl-client-key.pem \
49+
-e "SELECT 1"
50+
if [ $? -ne 0 ]; then
51+
# mariadb uses --ssl=TRUE instead of --ssl-mode=REQUIRED
52+
docker exec -it $NAME mysql -ussltest -ptest \
53+
--ssl=TRUE \
54+
--ssl-ca=/etc/mysql/conf.d/certs/ssl-ca-cert.pem \
55+
--ssl-cert=/etc/mysql/conf.d/certs/ssl-client-cert.pem \
56+
--ssl-key=/etc/mysql/conf.d/certs/ssl-client-key.pem \
57+
-e "SELECT 1"
58+
if [ $? -ne 0 ]; then
59+
>&2 echo "Problem with SSL"
60+
exit 1
61+
fi
62+
fi
63+
echo "Ran Init Script"
64+
exit 0
65+
fi
66+
done
67+
68+
# init script did not run
69+
>&2 echo "Unable to Run Init Script"
70+
exit 1

.ci/use-config.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cd $(dirname $0)/config
33

44
display_usage() {
5-
echo -e "\nUsage:\n$0 [config.json script] [host] [port]\n"
5+
echo -e "\nUsage:\n$0 [config.json script] [host] [port] [name] [supports json]\n"
66
}
77

88
# check whether user had supplied -h or --help . If yes display usage
@@ -38,3 +38,12 @@ then
3838
sed -i "s/3306/$3/g" ../../tests/SideBySide/config.json
3939
fi
4040

41+
if [ $# -ge 4 ]
42+
then
43+
sed -i "s/run\/mysql/run\/$4/g" ../../tests/SideBySide/config.json
44+
fi
45+
46+
if [ $# -ge 5 ]
47+
then
48+
sed -i "s/\"SupportsJson\": true/\"SupportsJson\": $5/g" ../../tests/SideBySide/config.json
49+
fi

.travis.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ sudo: required
22
dist: trusty
33
services: docker
44

5+
env:
6+
- IMAGE=mysql:5.7
7+
NAME=mysql
8+
SUPPORTS_JSON=true
9+
- IMAGE=percona:5.7
10+
NAME=percona
11+
SUPPORTS_JSON=true
12+
- IMAGE=mariadb:10.3
13+
NAME=mariadb
14+
SUPPORTS_JSON=false
15+
516
before_install:
6-
before_install:
7-
- chmod +x .ci/*.sh
8-
- |
9-
sed -i 's/3306:3306/3307:3306/g' .ci/docker-run-mysql.sh && \
10-
./.ci/docker-run-mysql.sh
17+
- .ci/docker-run.sh $IMAGE $NAME 3307
1118
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
1219
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
1320
- sudo apt-get update
@@ -17,13 +24,13 @@ script:
1724
- dotnet restore
1825
- dotnet test tests/MySqlConnector.Tests/MySqlConnector.Tests.csproj -c Release -f netcoreapp1.1.1
1926
- dotnet build tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
20-
- echo 'Executing tests with No Compression, No SSL' && ./.ci/use-config.sh config.json 172.17.0.1 3307 && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
27+
- echo 'Executing tests with No Compression, No SSL' && ./.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
2128
- echo 'Executing Debug Only tests' && time dotnet test tests/SideBySide/SideBySide.csproj -c Debug -f netcoreapp1.1.1 --filter "FullyQualifiedName~SideBySide.DebugOnlyTests"
22-
- echo 'Executing tests with Compression, No SSL' && ./.ci/use-config.sh config.compression.json 172.17.0.1 3307 && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
23-
- echo 'Executing tests with No Compression, SSL' && ./.ci/use-config.sh config.ssl.json 172.17.0.1 3307 && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
24-
- echo 'Executing tests with Compression, SSL' && ./.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
25-
- echo 'Executing tests with Unix Domain Socket, No Compression, No SSL' && ./.ci/use-config.sh config.uds.json && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
26-
- echo 'Executing tests with Buffering, No Compression, No SSL' && ./.ci/use-config.sh config.buffer.json 172.17.0.1 3307 && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
29+
- echo 'Executing tests with Compression, No SSL' && ./.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
30+
- echo 'Executing tests with No Compression, SSL' && ./.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
31+
- echo 'Executing tests with Compression, SSL' && ./.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
32+
- echo 'Executing tests with Unix Domain Socket, No Compression, No SSL' && ./.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
33+
- echo 'Executing tests with Buffering, No Compression, No SSL' && ./.ci/use-config.sh config.buffer.json 172.17.0.1 3307 $NAME $SUPPORTS_JSON && time dotnet test tests/SideBySide/SideBySide.csproj -c Release -f netcoreapp1.1.1
2734

2835
after_script:
2936
- chmod +x .ci/build-docs.sh && ./.ci/build-docs.sh

tests/SideBySide/CancelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public async Task CancelSlowQueryWithTokenAfterNextResult()
375375
// the call to NextResult should block until the token is cancelled
376376
var stopwatch = Stopwatch.StartNew();
377377
Assert.True(await reader.NextResultAsync(cts.Token));
378-
TestUtilities.AssertDuration(stopwatch, 450, 300);
378+
TestUtilities.AssertDuration(stopwatch, 450, 400);
379379

380380
int rows = 0;
381381
try

0 commit comments

Comments
 (0)