22 lines
1.2 KiB
Bash
22 lines
1.2 KiB
Bash
# MySQL container definition (sourced by dbtest.sh)
|
|
DB_NAME=mysql
|
|
DB_IMAGE=docker.io/library/mysql:8.4
|
|
DB_CONTAINER=relspec-test-mysql
|
|
DB_PORT=3309
|
|
DB_INTERNAL_PORT=3306
|
|
DB_ENV=(-e MYSQL_ROOT_PASSWORD=relspec_root_password -e MYSQL_DATABASE=relspec_test -e MYSQL_USER=relspec -e MYSQL_PASSWORD=relspec_test_password)
|
|
DB_INIT_MOUNT="$ROOT/tests/dbtest/init/mysql.sql:/docker-entrypoint-initdb.d/init.sql"
|
|
DB_CONN_VAR=RELSPEC_TEST_MYSQL_CONN
|
|
DB_CONN="relspec:relspec_test_password@tcp(localhost:3309)/relspec_test"
|
|
DB_DEFAULT_PKGS="./pkg/readers/mysql ./pkg/writers/mysql"
|
|
|
|
db_ready() { rt exec "$DB_CONTAINER" mysqladmin ping -h 127.0.0.1 -urelspec -prelspec_test_password --silent >/dev/null 2>&1; }
|
|
# Configure the final server after readiness; SET GLOBAL during entrypoint init
|
|
# only affects its temporary server and is reset before the tests connect.
|
|
db_post_init() {
|
|
rt exec "$DB_CONTAINER" mysql -uroot -prelspec_root_password \
|
|
-e 'SET GLOBAL log_bin_trust_function_creators = 1' >/dev/null
|
|
}
|
|
db_shell() { rt exec -it "$DB_CONTAINER" mysql -urelspec -prelspec_test_password relspec_test "$@"; }
|
|
db_exec_file() { rt exec -i "$DB_CONTAINER" mysql -urelspec -prelspec_test_password relspec_test < "$1"; }
|