Skip to content

Commit

Permalink
Run tests against Azure Database for MySQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Jul 6, 2018
1 parent 29fbed7 commit e1d2238
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .ci/docker-run.sh
Expand Up @@ -29,6 +29,11 @@ if [ "$IMAGE" == "mysql:8.0" ]; then
MYSQL_EXTRA='--default-authentication-plugin=mysql_native_password'
fi

if [ "$IMAGE" == "-" ]; then
echo "Skipping Docker container"
exit 0
fi

sudo mkdir -p run/$NAME
sudo chmod 777 run/$NAME

Expand Down
5 changes: 5 additions & 0 deletions .ci/use-config.sh
Expand Up @@ -41,6 +41,11 @@ fi
if [ $# -ge 4 ]
then
sed -i "s/run\/mysql/run\/$4/g" ../../tests/SideBySide/config.json
if [ "$4" = "azure" ]
then
sed -i "/PasswordlessUser/d" ../../tests/SideBySide/config.json
sed -i "/SecondaryDatabase/d" ../../tests/SideBySide/config.json
fi
fi

if [ $# -ge 5 ]
Expand Down
18 changes: 11 additions & 7 deletions .travis.yml
Expand Up @@ -3,6 +3,10 @@ dist: trusty
services: docker

env:
- IMAGE=-
NAME=azure
OMIT_FEATURES=CachingSha2Password,ErrorCodes,KnownCertificateAuthority,NoProxy,Sha256Password,Timeout,UuidToBin
CONNECTION_STRING="$AZURE_CONNECTION_STRING"
- IMAGE=mysql:5.6
NAME=mysql
OMIT_FEATURES=Json,Sha256Password,RsaEncryption,LargePackets,CachingSha2Password,SessionTrack,Tls11,Tls12,UuidToBin
Expand Down Expand Up @@ -33,17 +37,17 @@ before_install:
script:
- dotnet restore
- pushd tests/MySqlConnector.Tests && dotnet test -c Release && popd
- pushd tests/Conformance.Tests && CONNECTION_STRING="Server=localhost;Port=3307;User Id=mysqltest;Password='test;key=\"val';SSL Mode=None" dotnet test -c Release && popd
- pushd tests/Conformance.Tests && CONNECTION_STRING=${CONNECTION_STRING:-"Server=localhost;Port=3307;User Id=mysqltest;Password='test;key=\"val';SSL Mode=None"} dotnet test -c Release && popd
- pushd tests/SideBySide
- dotnet build SideBySide.csproj -c Release -f netcoreapp2.0
- echo 'Executing netcoreapp1.1.2 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp1.1.2
- echo 'Executing netcoreapp2.0 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
- echo 'Executing netcoreapp2.1 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.1
- echo 'Executing netcoreapp2.1 tests with Compression, No SSL' && ../../.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.1
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp1.1.2 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp1.1.2; fi
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp2.0 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0; fi
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp2.1 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.1; fi
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp2.1 tests with Compression, No SSL' && ../../.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.1; fi
- echo 'Executing netcoreapp1.1.2 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp1.1.2
- echo 'Executing netcoreapp2.1 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.1
- echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
- echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0; fi
- if [ "$NAME" != "azure" ]; then echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $OMIT_FEATURES && time dotnet test -c Release -f netcoreapp2.0; fi
- popd

after_script:
Expand Down
2 changes: 1 addition & 1 deletion tests/SideBySide/AppConfig.cs
Expand Up @@ -32,7 +32,7 @@ public static class AppConfig

public static IConfiguration Config => ConfigBuilder;

public static string ConnectionString => Config.GetValue<string>("Data:ConnectionString");
public static string ConnectionString => Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? Config.GetValue<string>("Data:ConnectionString");

public static string PasswordlessUser => Config.GetValue<string>("Data:PasswordlessUser");

Expand Down
4 changes: 2 additions & 2 deletions tests/SideBySide/CommandTimeoutTests.cs
Expand Up @@ -87,7 +87,7 @@ public void CommandTimeoutWithSleepSync()
Assert.Equal(ConnectionState.Closed, m_connection.State);
}

[Fact]
[SkippableFact(ServerFeatures.Timeout)]
public async Task CommandTimeoutWithSleepAsync()
{
using (var cmd = new MySqlCommand("SELECT SLEEP(120);", m_connection))
Expand Down Expand Up @@ -153,7 +153,7 @@ public void MultipleCommandTimeoutWithSleepSync()
Assert.Equal(ConnectionState.Closed, m_connection.State);
}

[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=87307")]
[SkippableFact(ServerFeatures.Timeout, Baseline = "https://bugs.mysql.com/bug.php?id=87307")]
public async Task MultipleCommandTimeoutWithSleepAsync()
{
var csb = new MySqlConnectionStringBuilder(m_connection.ConnectionString);
Expand Down
4 changes: 2 additions & 2 deletions tests/SideBySide/ConnectionPool.cs
Expand Up @@ -215,7 +215,7 @@ private async Task CheckCharacterSetAsync(string connectionString)
}
}

[Fact]
[SkippableFact(ServerFeatures.NoProxy)]
public async Task ClearConnectionPool()
{
var csb = AppConfig.CreateConnectionStringBuilder();
Expand Down Expand Up @@ -284,7 +284,7 @@ public async Task ClearConnectionPool()
}

#if !BASELINE
[Theory]
[SkippableTheory(ServerFeatures.NoProxy)]
[InlineData(1u, 3u, 0u, 5u)]
[InlineData(1u, 3u, 3u, 5u)]
public async Task ConnectionLifeTime(uint idleTimeout, uint delaySeconds, uint minPoolSize, uint maxPoolSize)
Expand Down
2 changes: 1 addition & 1 deletion tests/SideBySide/QueryTests.cs
Expand Up @@ -615,7 +615,7 @@ public void SumInts()
}
}

[Fact]
[SkippableFact(ServerFeatures.Timeout)]
public void UseReaderWithoutDisposing()
{
var csb = AppConfig.CreateConnectionStringBuilder();
Expand Down
1 change: 1 addition & 0 deletions tests/SideBySide/ServerFeatures.cs
Expand Up @@ -20,5 +20,6 @@ public enum ServerFeatures
Tls12 = 2048,
RoundDateTime = 4096,
UuidToBin = 8192,
NoProxy = 16384,
}
}
2 changes: 1 addition & 1 deletion tests/SideBySide/SslTests.cs
Expand Up @@ -119,7 +119,7 @@ public async Task ConnectSslBadCaCertificate()
}
}

[SkippableFact(ConfigSettings.RequiresSsl)]
[SkippableFact(ServerFeatures.NoProxy, ConfigSettings.RequiresSsl)]
public async Task ConnectSslTlsVersion()
{
using (var connection = new MySqlConnection(AppConfig.ConnectionString))
Expand Down

0 comments on commit e1d2238

Please sign in to comment.