From 118f9a0ec963ba22e111cfed937eda6d2511b074 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Tue, 15 Oct 2024 18:33:12 -0600 Subject: [PATCH] SKIP_SSL where needed --- containers/ddev-dbserver/test/basic_database.bats | 10 +++++----- containers/ddev-dbserver/test/custom_config.bats | 2 +- containers/ddev-dbserver/test/functions.sh | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/containers/ddev-dbserver/test/basic_database.bats b/containers/ddev-dbserver/test/basic_database.bats index 42142fdac61..1445fa530fc 100644 --- a/containers/ddev-dbserver/test/basic_database.bats +++ b/containers/ddev-dbserver/test/basic_database.bats @@ -15,22 +15,22 @@ function setup { @test "test user root and db access for ${DB_TYPE} ${DB_VERSION}" { - mysql --skip-ssl --user=root --password=root --database=mysql --host=127.0.0.1 --port=$HOSTPORT -e "SELECT 1;" - mysql --skip-ssl -udb -pdb --database=db --host=127.0.0.1 --port=$HOSTPORT -e "SHOW TABLES;" + mysql ${SKIP_SSL} --user=root --password=root --database=mysql --host=127.0.0.1 --port=$HOSTPORT -e "SELECT 1;" + mysql ${SKIP_SSL} -udb -pdb --database=db --host=127.0.0.1 --port=$HOSTPORT -e "SHOW TABLES;" } @test "make sure trigger capability works correctly on ${DB_TYPE} ${DB_VERSION}" { - mysql --skip-ssl -udb -pdb --database=db --host=127.0.0.1 --port=$HOSTPORT -e 'CREATE TABLE account (acct_num INT, amount DECIMAL(10,2)); CREATE TRIGGER ins_sum BEFORE INSERT ON account + mysql ${SKIP_SSL} -udb -pdb --database=db --host=127.0.0.1 --port=$HOSTPORT -e 'CREATE TABLE account (acct_num INT, amount DECIMAL(10,2)); CREATE TRIGGER ins_sum BEFORE INSERT ON account FOR EACH ROW SET @sum = @sum + NEW.amount;' } @test "check correct mysql/mariadb version for ${DB_TYPE} ${DB_VERSION}" { - reported_version=$(mysql --skip-ssl --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW VARIABLES like \"version\";" | awk '{sub( /\.[0-9]+(-.*)?$/, "", $2); print $2 }') + reported_version=$(mysql ${SKIP_SSL} --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW VARIABLES like \"version\";" | awk '{sub( /\.[0-9]+(-.*)?$/, "", $2); print $2 }') echo "# Reported mysql/mariadb version=$reported_version and DB_VERSION=${DB_VERSION}" [ "${reported_version}" = ${DB_VERSION} ] } @test "look for utf8mb4_general_ci configured on ${DB_TYPE} ${DB_VERSION}" { - mysql --skip-ssl --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW GLOBAL VARIABLES like \"collation_server\";" | grep "utf8mb4_general_ci" + mysql ${SKIP_SSL} --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW GLOBAL VARIABLES like \"collation_server\";" | grep "utf8mb4_general_ci" } diff --git a/containers/ddev-dbserver/test/custom_config.bats b/containers/ddev-dbserver/test/custom_config.bats index 70896381cae..90251b32643 100644 --- a/containers/ddev-dbserver/test/custom_config.bats +++ b/containers/ddev-dbserver/test/custom_config.bats @@ -15,7 +15,7 @@ function setup { @test "test with mysql/collation.cnf override ${DB_TYPE} ${DB_VERSION}" { docker exec $CONTAINER_NAME sh -c 'grep collation-server /mnt/ddev_config/mysql/collation.cnf' - mysql --skip-ssl --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW GLOBAL VARIABLES like \"collation_server\";" | grep "latin1_swedish_ci" + mysql ${SKIP_SSL} --user=root --password=root --skip-column-names --host=127.0.0.1 --port=$HOSTPORT -e "SHOW GLOBAL VARIABLES like \"collation_server\";" | grep "latin1_swedish_ci" } diff --git a/containers/ddev-dbserver/test/functions.sh b/containers/ddev-dbserver/test/functions.sh index 61bb9ed316f..06a168fc7ec 100644 --- a/containers/ddev-dbserver/test/functions.sh +++ b/containers/ddev-dbserver/test/functions.sh @@ -1,5 +1,8 @@ #!/bin/bash +SKIP_SSL="--skip-ssl" +if mysql --help | grep -q -v -- '--skip-ssl'; then SKIP_SSL=""; fi + function basic_setup { export CONTAINER_NAME="testserver" export HOSTPORT=31000