#!/bin/sh # dep8 smoke test for mysql-server # Author: Robie Basak # # This test should be declared in debian/tests/control with a dependency # on the package that provides a configured MariaDB server (eg. # mariadb-server). # # This test should be declared in debian/tests/control with the # following restrictions: # - allow-stderr (set -x always outputs to stderr) # - needs-root (to be able to log into the database) # - isolation-container (to be able to start service) # # 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 daemon 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 ! command -v systemctl then if ! /etc/init.d/mariadb status then echo "Did not find systemctl and daemon was not running, starting it.." /etc/init.d/mariadb 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.." # Compression plugins are separated from main server package # to own packages (for example LZ4 package mariadb-plugin-provider-lz4) # and they are installed after mariadb-server. # which means that they don't exist if MariaDB is not restarted systemctl restart mariadb fi mysql <&2 exit 1 fi mysql --user=testuser --password=testpassword testdatabase <&2 exit 1 fi done else if dpkg-query -W $plugin then echo "Error: Plugin $plugin was found even though it should not exist on a 32-bit and little-endian system" exit 1 fi fi