Skip to content

Commit

Permalink
SKIP_SSL where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Oct 16, 2024
1 parent 677b446 commit 118f9a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions containers/ddev-dbserver/test/basic_database.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

2 changes: 1 addition & 1 deletion containers/ddev-dbserver/test/custom_config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


Expand Down
3 changes: 3 additions & 0 deletions containers/ddev-dbserver/test/functions.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 118f9a0

Please sign in to comment.