[MENT-28] azure testing on ubuntu using tar server artifact

This commit is contained in:
rusher 2019-07-19 10:42:36 +02:00
Родитель 612c2fe9c3
Коммит 663f828401
5 изменённых файлов: 147 добавлений и 110 удалений

Просмотреть файл

@ -1,10 +1,6 @@
resources:
containers:
- container: ubuntu-1604
image: ubuntu:16.04
options: "--name ubuntu-1604 --add-host=mariadb.example.com:127.0.0.1 -v /usr/bin/docker:/tmp/docker:ro"
- container: ubuntu-1804
image: ubuntu:18.04
options: "--name ubuntu-1804 --add-host=mariadb.example.com:127.0.0.1 -v /usr/bin/docker:/tmp/docker:ro"
@ -20,8 +16,8 @@ jobs:
- script: |
java --version
mkdir tmp
chmod 777 .travis/gen-ssl.sh
.travis/gen-ssl.sh mariadb.example.com tmp
ls -lrt tmp
cp -R tmp $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'create SSL certificates'
@ -33,69 +29,75 @@ jobs:
- job: windowsTest
displayName: 'test windows'
pool:
vmImage: 'win1803'
vmImage: 'windows-2019'
dependsOn:
- SSLFiles
steps:
- task: DownloadPipelineArtifact@0
- task: DownloadPipelineArtifact@2
displayName: 'Download SSL files'
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- task: DownloadPipelineArtifact@1
displayName: 'Download 10.4 enterprise server artifact files'
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 server'
inputs:
buildType: 'specific'
project: '6d15af64-176c-496d-b583-fd2ae21d4df4'
pipeline: 'mariadb-corporation.MariaDBEnterprise'
branchName: 'refs/heads/10.4-enterprise'
artifactName: Windows
definition: '3'
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: 'Windows'
pipeline: 3
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/10.4-enterprise'
downloadPath: $(System.DefaultWorkingDirectory)
#buildVersionToDownload: 'latest'
buildVersionToDownload: 'specific'
buildId: 373
- script: |
choco install jdk8 -ia "INSTALLDIR=""c:\java"""
type C:\ProgramData\chocolatey\logs\chocolatey.log
Get-EnvironmentVariable -Name 'JAVA_HOME' -Scope 'Machine'
choco install maven
echo %PATH%
echo %JAVA_HOME%
refreshenv
echo %PATH%
echo %JAVA_HOME%
rem type C:\ProgramData\chocolatey\logs\chocolatey.log
displayName: 'install java + maven'
- script: |
msiexec /i $(System.DefaultWorkingDirectory)\win_build\win\packaging\mariadb-10.4.5-winx64.msi INSTALLDIR=c:\projects\server SERVICENAME=mariadb ALLOWREMOTEROOTACCESS=true /qn
dir $(System.DefaultWorkingDirectory)\win_build\
for /f %%a in ('dir /B $(System.DefaultWorkingDirectory)\win_build\mariadb-enterprise-10.*-winx64.msi') do set servername=$(System.DefaultWorkingDirectory)\win_build\%%a
echo %servername%
msiexec /i %servername% INSTALLDIR=c:\projects\server SERVICENAME=mariadb ALLOWREMOTEROOTACCESS=true /qn
c:\projects\server\bin\mysql.exe -e "create database testj" --user=root
c:\projects\server\bin\mysql.exe -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;" --user=root
displayName: 'install server'
- script: |
echo 127.0.0.1 mariadb.example.com >> %WINDIR%\System32\Drivers\Etc\Hosts
dir
displayName: 'set hostname'
- script: |
set JAVA_HOME=C:\java\
set PATH=%PATH%;%JAVA_HOME%\bin
java -version
C:\ProgramData\chocolatey\bin\mvn -version
C:\ProgramData\chocolatey\bin\mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=root" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
displayName: 'run tests'
rem search maven version
dir /B C:\ProgramData\chocolatey\lib\maven\apache-maven-*.*.* | findstr /x apache-maven-[0-9]\.[0-9]\.[0-9] > mavenversion.txt
set /p mavenversion= < mavenversion.txt
echo %mavenversion%
C:\ProgramData\chocolatey\lib\maven\%mavenversion%\bin\mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=someUser&password=Passw@rd2" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
if %ERRORLEVEL% EQU 0 (
echo Success
) else (
echo exit code is %errorlevel%
exit /b %errorlevel%
)
displayName: 'run tests'
- job: RunInContainer
pool:
vmImage: 'ubuntu-16.04'
displayName: 'test ubuntu bionic'
dependsOn:
- SSLFiles
strategy:
matrix:
ubuntu-1604:
containerImage: ubuntu-1604
containerName: xenial
ubuntu-1804:
containerImage: ubuntu-1804
containerName: bionic
@ -104,77 +106,35 @@ jobs:
steps:
- task: DownloadPipelineArtifact@0
- task: DownloadPipelineArtifact@2
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- script: /tmp/docker exec -t -u 0 $(containerImage) sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: Set up sudo
displayName: 'Set up sudo'
- task: DownloadPipelineArtifact@1
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 enterprise server artifact files'
inputs:
buildType: 'specific'
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: '$(containerImage)'
pipeline: 3
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/10.4-enterprise'
downloadPath: $(System.DefaultWorkingDirectory)
project: '6d15af64-176c-496d-b583-fd2ae21d4df4'
pipeline: 'mariadb-corporation.MariaDBEnterprise'
artifactName: $(containerImage)
branchName: 'refs/heads/10.4-enterprise'
#buildVersionToDownload: 'latest'
definition: '3'
buildVersionToDownload: 'specific'
buildId: 373
- task: DownloadPipelineArtifact@1
- task: DownloadPipelineArtifact@2
displayName: 'Download galera server artifact files'
inputs:
buildType: 'specific'
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: $(containerImage)
runVersion: 'latestFromBranch'
pipeline: 2
runBranch: 'refs/heads/es-mariadb-4.x'
downloadPath: $(System.DefaultWorkingDirectory)
project: '6d15af64-176c-496d-b583-fd2ae21d4df4'
pipeline: 'mariadb-corporation.es-galera'
artifactName: $(containerImage)
branchName: 'refs/heads/es-mariadb-4.x'
#buildVersionToDownload: 'latest'
definition: '2'
buildVersionToDownload: 'specific'
buildId: 337
- script: |
ls -lrt .
echo "Installing server from deb"
sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
rm -R mariadb-plugin*
rm -R *-dev.deb
rm -R *-test.deb
chmod 777 .
sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates tzdata pwgen
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password password !Passw0rd"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password_again password !Passw0rd"
sudo apt-get update -y
sudo apt-get install --allow-unauthenticated -y curl libdbi-perl rsync socat libnuma1 libaio1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2 gawk lsof psmisc libaio1 perl libreadline5
echo 'Installing deb files'
sudo apt install -f -y ./*.deb
sudo ls -lrt /etc/mysql/
sudo bash -c 'echo "ssl-ca=$(System.DefaultWorkingDirectory)/tmp/ca.crt" >> /etc/mysql/mariadb-enterprise.cnf'
sudo bash -c 'echo "ssl-cert=$(System.DefaultWorkingDirectory)/tmp/server.crt" >> /etc/mysql/mariadb-enterprise.cnf'
sudo bash -c 'echo "ssl-key=$(System.DefaultWorkingDirectory)/tmp/server.key" >> /etc/mysql/mariadb-enterprise.cnf'
sudo tail -n 500 /etc/mysql/mariadb-enterprise.cnf
sudo service mysql restart
displayName: 'install server'
- script: |
sudo mysql -e "CREATE USER 'root'@'%' identified by 'Passw@rd2';"
sudo mysql -e "GRANT ALL on *.* to 'root'@'%' identified by 'Passw@rd2' with grant option;"
sudo mysql -e "CREATE DATABASE testj;"
displayName: 'Add non socket user'
- script: |
sudo apt install -y default-jdk
@ -184,8 +144,82 @@ jobs:
displayName: 'Install java + maven'
- script: |
ls -lrt /usr/share/maven/bin/
/usr/share/maven/bin/mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=root&password=Passw@rd2" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
tar xf mariadb-enterprise*
sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates tzdata pwgen
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password password P4ssw@rd"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password_again password P4ssw@rd"
sudo apt-get update -y
sudo apt-get install --allow-unauthenticated -f -y libaio1 libaio-dev libxml2 libcurl4 curl libc-dev linux-libc-dev libc-dev-bin libdbi-perl rsync socat libnuma1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2 gawk lsof psmisc perl libreadline5
cd mariadb-enterprise*/
sudo groupadd mysql
sudo useradd -g mysql mysql
export PROJ_PATH=`pwd`
echo $PROJ_PATH
cat <<EOT >> my.cnf
[mysqld]
port=3306
max_allowed_packet=16M
datadir=$PROJ_PATH/data
socket=/tmp/mysql.sock
user=mysql
ssl-ca=$(System.DefaultWorkingDirectory)/tmp/ca.crt
ssl-cert=$(System.DefaultWorkingDirectory)/tmp/server.crt
ssl-key=$(System.DefaultWorkingDirectory)/tmp/server.key
EOT
sudo chown mysql $PROJ_PATH/my.cnf
sudo tail -n 5000 $PROJ_PATH/my.cnf
sudo chmod 777 $PROJ_PATH
sudo ln -s $PROJ_PATH /usr/local/mysql
sudo ./scripts/mysql_install_db --defaults-file=$PROJ_PATH/my.cnf --user=mysql
sudo chown -R root .
sudo chown -R mysql data
export PATH=$PATH:$PROJ_PATH/bin/
env:
WORKING_DIR: $(System.DefaultWorkingDirectory)
displayName: 'install server'
- script: |
cd mariadb-enterprise*/
sudo ./bin/mysqld --defaults-file=./my.cnf &
for i in {30..0}; do
if sudo ./bin/mysql -e "SELECT 1" &> /dev/null; then
echo 'MySQL connected...'
break
fi
echo 'MySQL init process in progress...'
sleep 1
done
if [ "$i" = 0 ]; then
echo >&2 'MySQL init process failed.'
sudo ./bin/mysql -e "SELECT 1"
exit 1
fi
sudo ./bin/mysql -e "CREATE USER 'someUser'@'%' identified by 'Passw@rd2';"
sudo ./bin/mysql -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;"
sudo ./bin/mysql -e "CREATE DATABASE testj;"
cd ..
/usr/share/maven/bin/mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=someUser&password=Passw@rd2" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
if [ $? -ne 0 ]; then
exit 1
fi
cd mariadb-enterprise*/
sudo ./bin/mysqladmin shutdown
env:
JAVA_HOME: "/usr/lib/jvm/default-java"
MAVEN_HOME: "/opt/maven"

Просмотреть файл

@ -589,20 +589,25 @@ public class ConnectionTest extends BaseTest {
throw new AssumptionViolatedException("server doesn't have ed25519 plugin, cancelling test");
}
try {
stmt.execute("CREATE USER verificationEd25519AuthPlugin@'%' IDENTIFIED "
+ "VIA ed25519 USING 'Dl7wP5om2lNrAfxWw3ooyZKDAoBztFNuhtVFdIrWfi0'");
if (minVersion(10, 4)) {
stmt.execute("CREATE USER verificationEd25519AuthPlugin IDENTIFIED "
+ "VIA ed25519 USING PASSWORD('MySup8%rPassw@ord')");
} else {
stmt.execute("CREATE USER verificationEd25519AuthPlugin IDENTIFIED "
+ "VIA ed25519 USING '6aW9C7ENlasUfymtfMvMZZtnkCVlcb1ssxOLJ0kj/AA'");
}
} catch (SQLException sqle) {
//already existing
}
stmt.execute("GRANT ALL on " + database + ".* to verificationEd25519AuthPlugin@'%'");
stmt.execute("GRANT ALL on " + database + ".* to verificationEd25519AuthPlugin");
String url = "jdbc:mariadb://" + hostname + ((port == 0) ? "" : ":" + port) + "/" + database
+ "?user=verificationEd25519AuthPlugin&password=!Passw0rd3&debug=true";
+ "?user=verificationEd25519AuthPlugin&password=MySup8%rPassw@ord";
try (Connection connection = openNewConnection(url)) {
//must have succeed
}
stmt.execute("drop user verificationEd25519AuthPlugin@'%'");
stmt.execute("drop user verificationEd25519AuthPlugin");
}

Просмотреть файл

@ -1435,19 +1435,16 @@ public class DriverTest extends BaseTest {
}
String path = rs.getString(2);
st.execute("CREATE USER testSocket@'" + ((hostname == null) ? "localhost" : hostname) + "' IDENTIFIED VIA unix_socket");
try {
st.execute("INSTALL SONAME 'auth_socket'");
} catch (SQLException e) {
//dismiss, can already be installed
}
String connString = connU + "?user=testSocket&localSocket=" + path + "&profileSql=true";
st.execute("CREATE USER testSocket@'localhost' IDENTIFIED BY 'MySup5%rPassw@ord'");
st.execute("GRANT ALL on *.* to testSocket@'localhost' IDENTIFIED BY 'MySup5%rPassw@ord'");
st.execute("FLUSH PRIVILEGES");
String connString = connU + "?user=testSocket&password=MySup5%rPassw@ord&localSocket=" + path;
System.out.println(connString);
try (Connection connection = openConnection(connString, null)) {
rs = connection.createStatement().executeQuery("select 1");
assertTrue(rs.next());
}
st.execute("DROP user testSocket@'" + ((hostname == null) ? "localhost" : hostname) + "'");
st.execute("DROP user testSocket@'localhost'");
}
@Test

Просмотреть файл

@ -237,6 +237,7 @@ public class SslTest extends BaseTest {
@Test
public void useSslForceTlsV1() throws Exception {
Assume.assumeFalse(isMariadbServer() && minVersion(10, 4));
useSslForceTls("TLSv1");
}
@ -279,10 +280,10 @@ public class SslTest extends BaseTest {
@Test
public void useSslForceTlsV12AndCipher() throws Exception {
Assume.assumeFalse(Platform.isWindows());
Assume.assumeFalse((Platform.isWindows() && !isMariadbServer()) || (isMariadbServer() && Platform.isWindows() && !minVersion(10, 4)));
// Only test with MariaDB since MySQL community is compiled with yaSSL
if (isMariadbServer()) {
useSslForceTls("TLSv1.2", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256");
useSslForceTls("TLSv1.2", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256");
}
}

Просмотреть файл

@ -431,11 +431,11 @@ public class StoredProcedureTest extends BaseTest {
} catch (SQLException e) {
//eat exception
}
statement.execute("CREATE USER 'test_jdbc'@'%' IDENTIFIED BY 'test_jdbc'");
statement.execute("GRANT ALL PRIVILEGES ON testj.* TO 'test_jdbc'@'%' WITH GRANT OPTION");
statement.execute("CREATE USER 'test_jdbc'@'%' IDENTIFIED BY 'testJ@dc1'");
statement.execute("GRANT ALL PRIVILEGES ON testj.* TO 'test_jdbc'@'%' IDENTIFIED BY 'testJ@dc1' WITH GRANT OPTION");
Properties properties = new Properties();
properties.put("user", "test_jdbc");
properties.put("password", "test_jdbc");
properties.put("password", "testJ@dc1");
createProcedure("testMetaCatalog", "(x int, out y int)\nBEGIN\nSET y = 2;\n end\n");