Import tests
This commit is contained in:
parent
02403268cc
commit
7e9050edf5
9 changed files with 375 additions and 1 deletions
44
connector-example-socket/Test.java
Normal file
44
connector-example-socket/Test.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// https://fedoraproject.org/wiki/MariaDB_JDBC_connector
|
||||
import java.sql.*;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// create our mysql database connection
|
||||
String socketFile = "/var/lib/mysql/mysql.sock";
|
||||
if (args.length == 1) {
|
||||
socketFile = args[0];
|
||||
}
|
||||
String host = "localhost";
|
||||
// use clearly different port to be sure we connect over socket
|
||||
String port = "55556";
|
||||
String dbname = "information_schema";
|
||||
String url = "jdbc:mariadb://" + host + ":" + port + "/" + dbname + "?localSocket=" + socketFile;
|
||||
String username = "root";
|
||||
String password = "";
|
||||
Connection conn = DriverManager.getConnection(url, username, password);
|
||||
|
||||
// our SQL SELECT query.
|
||||
// if you only need a few columns, specify them by name instead of using "*"
|
||||
String query = "SELECT * FROM ENGINES";
|
||||
|
||||
// create the java statement
|
||||
Statement st = conn.createStatement();
|
||||
|
||||
// execute the query, and get a java resultset
|
||||
ResultSet rs = st.executeQuery(query);
|
||||
|
||||
// iterate through the java resultset
|
||||
while (rs.next()) {
|
||||
String engine = rs.getString("ENGINE");
|
||||
String support = rs.getString("SUPPORT");
|
||||
String comment = rs.getString("COMMENT");
|
||||
String transactions = rs.getString("TRANSACTIONS");
|
||||
String xa = rs.getString("XA");
|
||||
String savepoints = rs.getString("SAVEPOINTS");
|
||||
|
||||
// print the results
|
||||
System.out.format("%s, %s, %s, %s, %s, %s\n", engine, support, comment, transactions, xa, savepoints);
|
||||
}
|
||||
st.close();
|
||||
}
|
||||
}
|
||||
15
connector-example-socket/main.fmf
Normal file
15
connector-example-socket/main.fmf
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
summary: example connector usage with connection over socket
|
||||
description: |
|
||||
example connector usage with connection over socket
|
||||
contact: Jakub Heger <jheger@redhat.com>
|
||||
component: []
|
||||
require:
|
||||
- mariadb-java-client
|
||||
- mariadb-server
|
||||
- jna
|
||||
- util-linux
|
||||
duration: 5m
|
||||
enabled: true
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1683112
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1697372
|
||||
65
connector-example-socket/runtest.sh
Executable file
65
connector-example-socket/runtest.sh
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
#!/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
|
||||
38
connector-example/Test.java
Normal file
38
connector-example/Test.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// https://fedoraproject.org/wiki/MariaDB_JDBC_connector
|
||||
import java.sql.*;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// create our mysql database connection
|
||||
String host = "localhost";
|
||||
String dbname = "information_schema";
|
||||
String url = "jdbc:mariadb://" + host + "/" + dbname;
|
||||
String username = "root";
|
||||
String password = "";
|
||||
Connection conn = DriverManager.getConnection(url, username, password);
|
||||
|
||||
// our SQL SELECT query.
|
||||
// if you only need a few columns, specify them by name instead of using "*"
|
||||
String query = "SELECT * FROM ENGINES";
|
||||
|
||||
// create the java statement
|
||||
Statement st = conn.createStatement();
|
||||
|
||||
// execute the query, and get a java resultset
|
||||
ResultSet rs = st.executeQuery(query);
|
||||
|
||||
// iterate through the java resultset
|
||||
while (rs.next()) {
|
||||
String engine = rs.getString("ENGINE");
|
||||
String support = rs.getString("SUPPORT");
|
||||
String comment = rs.getString("COMMENT");
|
||||
String transactions = rs.getString("TRANSACTIONS");
|
||||
String xa = rs.getString("XA");
|
||||
String savepoints = rs.getString("SAVEPOINTS");
|
||||
|
||||
// print the results
|
||||
System.out.format("%s, %s, %s, %s, %s, %s\n", engine, support, comment, transactions, xa, savepoints);
|
||||
}
|
||||
st.close();
|
||||
}
|
||||
}
|
||||
26
connector-example/main.fmf
Normal file
26
connector-example/main.fmf
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
summary: example connector usage
|
||||
description: |
|
||||
example connector usage
|
||||
contact: Jakub Heger <jheger@redhat.com>
|
||||
component: []
|
||||
require:
|
||||
- mariadb-java-client
|
||||
- mariadb-server
|
||||
- util-linux
|
||||
duration: 5m
|
||||
enabled: true
|
||||
tag:
|
||||
- CI-Tier-1
|
||||
- TIPfail_Apps
|
||||
- TIPpass
|
||||
- Tier1
|
||||
tier: '1'
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1683112
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: distro == rhel-7 and product != rhscl
|
||||
continue: false
|
||||
- enabled: false
|
||||
when: distro == rhel-alt-7 and product != rhscl
|
||||
continue: false
|
||||
64
connector-example/runtest.sh
Executable file
64
connector-example/runtest.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#!/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
|
||||
# Description: example connector usage
|
||||
# Author: Karel Volný <kvolny@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 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.'"
|
||||
# Set passwordless root
|
||||
rlRun "mariadb -u root -e \"grant all privileges on *.* to 'root'@'localhost' identified by '';\""
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "java -Djdbc.drivers=org.mariadb.jdbc.Driver -cp /usr/lib/java/mariadb-java-client.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
|
||||
2
main.fmf
2
main.fmf
|
|
@ -1,3 +1,3 @@
|
|||
contact: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
contact: Marian Koncek <mkoncek@redhat.com>
|
||||
framework: beakerlib
|
||||
test: ./runtest.sh
|
||||
|
|
|
|||
32
upstream-testsuite/main.fmf
Normal file
32
upstream-testsuite/main.fmf
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
summary: Runs upstream testsuite
|
||||
description: |
|
||||
Runs the compiled tests using junit5
|
||||
enabled: true
|
||||
tag:
|
||||
- Tier1
|
||||
- rhel-buildroot
|
||||
tier: '1'
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: arch == s390x
|
||||
continue: false
|
||||
- enabled: false
|
||||
when: distro < rhel-8
|
||||
continue: false
|
||||
- enabled: false
|
||||
when: distro > rhel-8
|
||||
continue: false
|
||||
contact: Marian Koncek <mkoncek@redhat.com>
|
||||
component:
|
||||
- mariadb-java-client
|
||||
framework: beakerlib
|
||||
require:
|
||||
- mariadb-server
|
||||
- mariadb-java-client
|
||||
- mariadb-java-client-tests
|
||||
- jna
|
||||
- junit5
|
||||
- apache-commons-lang3
|
||||
- osgi-core
|
||||
- osgi-compendium
|
||||
duration: 35m
|
||||
90
upstream-testsuite/runtest.sh
Executable file
90
upstream-testsuite/runtest.sh
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/postgresql-jdbc/Sanity/upstream-testsuite
|
||||
# Description: Runs upstream testsuite
|
||||
# Author: Zuzana Miklankova <zmiklank@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2022 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# 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, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
REQUIRES="${REQUIRES:-mariadb-java-client}"
|
||||
|
||||
JAVA="${JAVA:-java}"
|
||||
JAVAC="${JAVAC:-javac}"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlLog "$(readlink -f $(which $JAVA))"
|
||||
rlLog "$(readlink -f $(which $JAVAC))"
|
||||
rlLog "$(rpm -qf /usr/lib/java/mariadb-java-client.jar)"
|
||||
rlAssertRpm --all
|
||||
rlRun "useradd mockbuild -m"
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "chmod a+rwx $TmpDir" 0 "fixing directory permissions"
|
||||
rlRun "pushd $TmpDir"
|
||||
|
||||
rlRun "JUNIT_CLASSPATH=/usr/share/java/mariadb-java-client-tests.jar:/usr/lib/java/mariadb-java-client.jar:"
|
||||
rlRun "JUNIT_CLASSPATH+=$(cat /usr/share/mariadb-java-client-tests/classpath)"
|
||||
for jar in ${JUNIT_CLASSPATH//:/ }; do
|
||||
rlAssertExists "${jar}"
|
||||
done
|
||||
|
||||
rlRun "mariadb-install-db --user=mysql --datadir=/var/lib/mysql"
|
||||
rlRun "su -s /bin/bash mysql -c \"mariadbd --general-log=1 --log_warnings=9 &\""
|
||||
# wait until the server is ready
|
||||
rlRun "tail -f /var/log/mariadb/mariadb.log | grep -q 'mariadbd: ready for connections.'"
|
||||
|
||||
# Set passwordless root
|
||||
rlRun "mariadb -u root -e \"grant all privileges on *.* to 'root'@'localhost' identified by '';\""
|
||||
rlRun "mariadb -u root -e \"create database testj;\""
|
||||
rlRun "cat /var/log/mariadb/mariadb.log"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
# -Djunit.jupiter.extensions.autodetection.enabled=true -- unneeded for now
|
||||
rlRun "su mockbuild -c \"ADDITIONAL_FLAGS='-Djunit.jupiter.extensions.autodetection.enabled=true' \
|
||||
/usr/bin/junit-platform-console execute -cp ${JUNIT_CLASSPATH}\
|
||||
--details=verbose --disable-ansi-colors\
|
||||
--exclude-classname 'org.mariadb.jdbc.integration.PooledConnectionTest'\
|
||||
--exclude-classname 'org.mariadb.jdbc.integration.ConnectionTest'\
|
||||
--exclude-classname 'org.mariadb.jdbc.integration.PoolDataSourceTest'\
|
||||
--exclude-classname 'org.mariadb.jdbc.integration.DataSourceTest'\
|
||||
;\""
|
||||
if ! rlGetPhaseState; then
|
||||
rlRun "cat /var/log/mariadb/mariadb.log"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "killall mariadbd"
|
||||
rlRun "rm -r /var/lib/mysql /var/log/mariadb/mariadb.log"
|
||||
rlBundleLogs *.log
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
rlJournalPrintText
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue