mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
03119c5890
As initially most tests fail, they have allow_failures defined so that testing anyway proceeds all the way to the final 'upgrade extras' stage. All of these tests work for downstream Debian packaging of MariaDB 10.4 and should eventually pass on upstream MariaDB 10.5 as well. Also upstream the Debian autopkgtests from MariaDB 10.4 in Debian so that pipeline includes running mtr.
92 lines
2.7 KiB
Bash
92 lines
2.7 KiB
Bash
#!/bin/sh
|
|
# dep8 smoke test for mysql-server
|
|
# Author: Robie Basak <robie.basak at canonical.com>
|
|
#
|
|
# This test should be declared in debian/tests/control with a dependency
|
|
# on the package that provides a configured MariaDB server (eg.
|
|
# mariadb-server-10.5).
|
|
#
|
|
# This test should be declared in debian/tests/control with the
|
|
# following restrictions:
|
|
#
|
|
# needs-root (to be able to log into the database)
|
|
# allow-stderr
|
|
#
|
|
# This test:
|
|
#
|
|
# 1) Creates a test database and test user as the root user.
|
|
#
|
|
# 2) Creates a test table and checks it appears to operate normally
|
|
# using the test user and test database.
|
|
#
|
|
# 3) Checks compression support for InnoDB & RocksDB engine.
|
|
|
|
echo "Running test 'smoke'"
|
|
set -ex
|
|
|
|
# Start the deamon if it was not running. For example in Docker testing
|
|
# environments there might not be any systemd et al and the service needs to
|
|
# be started manually.
|
|
if ! which systemctl
|
|
then
|
|
if ! /etc/init.d/mysql status
|
|
then
|
|
echo "Did not find systemctl and deamon was not running, starting it.."
|
|
/etc/init.d/mysql start
|
|
fi
|
|
else
|
|
# If systemd (and systemctl) is available, but the service did not start, then
|
|
# this smoke test is supposed to fail if next commands don't work.
|
|
echo "Found systemctl, continuing smoke test.."
|
|
fi
|
|
|
|
mysql <<EOT
|
|
CREATE DATABASE testdatabase;
|
|
CREATE USER 'testuser'@'localhost' identified by 'testpassword';
|
|
GRANT ALL ON testdatabase.* TO 'testuser'@'localhost';
|
|
EOT
|
|
|
|
mysql testdatabase <<EOT
|
|
CREATE TABLE foo (bar INTEGER);
|
|
INSERT INTO foo (bar) VALUES (41);
|
|
EOT
|
|
|
|
result=$(echo 'SELECT bar+1 FROM foo;'|mysql --batch --skip-column-names --user=testuser --password=testpassword testdatabase)
|
|
if [ "$result" != "42" ]; then
|
|
echo "Unexpected result" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mysql --user=testuser --password=testpassword testdatabase <<EOT
|
|
DROP TABLE foo;
|
|
EOT
|
|
|
|
mysql <<EOT
|
|
DROP DATABASE testdatabase;
|
|
DROP USER 'testuser'@'localhost';
|
|
EOT
|
|
|
|
mysql <<EOT
|
|
SET GLOBAL innodb_compression_algorithm=lz4;
|
|
SET GLOBAL innodb_compression_algorithm=snappy;
|
|
SET GLOBAL innodb_compression_algorithm=zlib;
|
|
SET GLOBAL innodb_compression_algorithm=none;
|
|
EOT
|
|
|
|
# Check whether RocksDB should be installed or not.
|
|
plugin=mariadb-plugin-rocksdb
|
|
if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
|
|
[ "$(dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)" = little ]; then
|
|
dpkg-query -W $plugin
|
|
|
|
LOG=/var/lib/mysql/#rocksdb/LOG
|
|
# XXX: The server may only be started during the install of
|
|
# mariadb-server-10.5, which happens before that of the plugin.
|
|
[ -e $LOG ] || mysql -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';"
|
|
# XXX: rocksdb_supported_compression_types variable does not report ZSTD.
|
|
for a in LZ4 Snappy Zlib ZSTD; do
|
|
grep -qE "k$a(Compression)? supported: 1" $LOG
|
|
done
|
|
else
|
|
! dpkg-query -W $plugin
|
|
fi
|