65 lines
2.4 KiB
Bash
Executable file
65 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
#
|
|
# runtest.sh of /CoreOS/mariadb-java-client/Sanity/JDBC-connector-example-socket
|
|
# Description: example connector usage with connection over socket
|
|
# Author: Jakub Janco <jjanco@redhat.com>
|
|
#
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
#
|
|
# Copyright (c) 2019 Red Hat, Inc.
|
|
#
|
|
# This program is free software: you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation, either version 2 of
|
|
# the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be
|
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
# PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
#
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# Include Beaker environment
|
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
|
PACKAGE="mariadb-java-client"
|
|
TestDir=$PWD
|
|
|
|
rlJournalStart
|
|
rlPhaseStartSetup
|
|
rlAssertRpm $PACKAGE
|
|
rlAssertRpm jna
|
|
rlAssertRpm mariadb-server
|
|
rlLogInfo "$(rpm -q --whatprovides java-devel)"
|
|
|
|
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
|
rlRun "cp Test.java $TmpDir/."
|
|
rlRun "pushd $TmpDir"
|
|
|
|
rlRun "mariadb-install-db --user=mysql --datadir=/var/lib/mysql"
|
|
rlRun "su -s /bin/bash mysql -c \"mariadbd --verbose --general-log=1 &\""
|
|
# wait until the server is ready
|
|
rlRun "tail -f /var/log/mariadb/mariadb.log | grep -q 'mariadbd: ready for connections.'"
|
|
|
|
rlAssertExists "/var/lib/mysql/mysql.sock"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartTest
|
|
rlRun "java -Djdbc.drivers=org.mariadb.jdbc.Driver -cp /usr/lib/java/mariadb-java-client.jar:/usr/lib/java/jna.jar:. Test.java > output.log"
|
|
rlAssertGrep "PERFORMANCE_SCHEMA" "output.log"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartCleanup
|
|
rlRun "killall mariadbd"
|
|
rlRun "rm -r /var/lib/mysql /var/log/mariadb/mariadb.log"
|
|
rlRun "popd"
|
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
rlPhaseEnd
|
|
rlJournalPrintText
|
|
rlJournalEnd
|