diff --git a/.ci/docker-run.sh b/.ci/docker-run.sh index 0ecfc57c4..bfd6ae6f2 100755 --- a/.ci/docker-run.sh +++ b/.ci/docker-run.sh @@ -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 diff --git a/.ci/use-config.sh b/.ci/use-config.sh index 51bf22b53..af84fdfe5 100755 --- a/.ci/use-config.sh +++ b/.ci/use-config.sh @@ -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 ] diff --git a/.travis.yml b/.travis.yml index 1e814c0cc..f26f49819 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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: diff --git a/tests/SideBySide/AppConfig.cs b/tests/SideBySide/AppConfig.cs index af77a46a5..ca0da0af4 100644 --- a/tests/SideBySide/AppConfig.cs +++ b/tests/SideBySide/AppConfig.cs @@ -32,7 +32,7 @@ public static class AppConfig public static IConfiguration Config => ConfigBuilder; - public static string ConnectionString => Config.GetValue("Data:ConnectionString"); + public static string ConnectionString => Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? Config.GetValue("Data:ConnectionString"); public static string PasswordlessUser => Config.GetValue("Data:PasswordlessUser"); diff --git a/tests/SideBySide/CommandTimeoutTests.cs b/tests/SideBySide/CommandTimeoutTests.cs index a0387e5b3..a09483f3c 100644 --- a/tests/SideBySide/CommandTimeoutTests.cs +++ b/tests/SideBySide/CommandTimeoutTests.cs @@ -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)) @@ -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); diff --git a/tests/SideBySide/ConnectionPool.cs b/tests/SideBySide/ConnectionPool.cs index 3e4dacf0e..f8b46d71c 100644 --- a/tests/SideBySide/ConnectionPool.cs +++ b/tests/SideBySide/ConnectionPool.cs @@ -215,7 +215,7 @@ private async Task CheckCharacterSetAsync(string connectionString) } } - [Fact] + [SkippableFact(ServerFeatures.NoProxy)] public async Task ClearConnectionPool() { var csb = AppConfig.CreateConnectionStringBuilder(); @@ -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) diff --git a/tests/SideBySide/QueryTests.cs b/tests/SideBySide/QueryTests.cs index b3e01e290..baf56702a 100644 --- a/tests/SideBySide/QueryTests.cs +++ b/tests/SideBySide/QueryTests.cs @@ -615,7 +615,7 @@ public void SumInts() } } - [Fact] + [SkippableFact(ServerFeatures.Timeout)] public void UseReaderWithoutDisposing() { var csb = AppConfig.CreateConnectionStringBuilder(); diff --git a/tests/SideBySide/ServerFeatures.cs b/tests/SideBySide/ServerFeatures.cs index 01531f6c8..cefac7bef 100644 --- a/tests/SideBySide/ServerFeatures.cs +++ b/tests/SideBySide/ServerFeatures.cs @@ -20,5 +20,6 @@ public enum ServerFeatures Tls12 = 2048, RoundDateTime = 4096, UuidToBin = 8192, + NoProxy = 16384, } } diff --git a/tests/SideBySide/SslTests.cs b/tests/SideBySide/SslTests.cs index cb80c4ac7..8eb740f4a 100644 --- a/tests/SideBySide/SslTests.cs +++ b/tests/SideBySide/SslTests.cs @@ -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))