From 63d68bb3d56ed998f172f300fce91786e0c93606 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 6 Jul 2026 17:45:38 +0200 Subject: [PATCH] use docker healthcmd --- .github/workflows/ci.yml | 10 +++++++++- Tests/Mysql/MysqlDriverTest.php | 3 --- Tests/Mysqli/MysqliDriverTest.php | 8 -------- Tests/Pgsql/PgsqlDriverTest.php | 3 --- Tests/Sqlsrv/SqlsrvDriverTest.php | 3 --- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51fca5c2..45e19955 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,6 +101,8 @@ jobs: MYSQL_PASSWORD: joomla_ut MYSQL_ROOT_PASSWORD: joomla_ut MYSQL_DATABASE: joomla_ut + options: >- + --health-cmd="mysqladmin ping -h localhost -u joomla_ut -pjoomla_ut" tests-unit-mariadb: name: Run Unit tests on MariaDB @@ -125,6 +127,8 @@ jobs: MARIADB_PASSWORD: joomla_ut MARIADB_ROOT_PASSWORD: joomla_ut MARIADB_DATABASE: joomla_ut + options: >- + --health-cmd="healthcheck.sh --connect --innodb_initialized" tests-unit-postgres: name: Run Unit tests on PostgreSQL @@ -148,7 +152,9 @@ jobs: env: POSTGRES_USER: root POSTGRES_PASSWORD: joomla_ut - POSTGRES_DB: test_joomla + POSTGRES_DB: joomla_ut + options: >- + --health-cmd="pg_isready -d joomla_ut" tests-unit-sqlsrv: name: Run Unit tests on SQLsrv @@ -182,6 +188,8 @@ jobs: SA_PASSWORD: Password12! ACCEPT_EULA: Y MSSQL_PID: Developer + options: >- + --health-cmd="bash -c 'SQLCMD=$(command -v /opt/mssql-tools/bin/sqlcmd || command -v /opt/mssql-tools18/bin/sqlcmd); [ -z \"$SQLCMD\" ] && exit 1; $SQLCMD -S localhost -U sa -P Password12! -C -Q SELECT\ 1'" tests-unit-windows: name: Run Unit tests on MSSQL (Windows) diff --git a/Tests/Mysql/MysqlDriverTest.php b/Tests/Mysql/MysqlDriverTest.php index feae9357..1d537a62 100644 --- a/Tests/Mysql/MysqlDriverTest.php +++ b/Tests/Mysql/MysqlDriverTest.php @@ -36,9 +36,6 @@ class MysqlDriverTest extends AbstractDatabaseDriverTestCase */ public static function setUpBeforeClass(): void { - // Give the container a chance to get ready - sleep(20); - parent::setUpBeforeClass(); if (!static::$connection || static::$connection->getName() !== 'mysql') { diff --git a/Tests/Mysqli/MysqliDriverTest.php b/Tests/Mysqli/MysqliDriverTest.php index 59d5d33d..c34f7769 100644 --- a/Tests/Mysqli/MysqliDriverTest.php +++ b/Tests/Mysqli/MysqliDriverTest.php @@ -7,7 +7,6 @@ namespace Joomla\Database\Tests\Mysqli; use Joomla\Database\DatabaseDriver; -use Joomla\Database\DatabaseFactory; use Joomla\Database\Exception\ExecutionFailureException; use Joomla\Database\Mysqli\MysqliDriver; use Joomla\Database\Mysqli\MysqliExporter; @@ -37,13 +36,6 @@ class MysqliDriverTest extends AbstractDatabaseDriverTestCase */ public static function setUpBeforeClass(): void { - $host = getenv('JOOMLA_TEST_DB_HOST'); - $port = getenv('JOOMLA_TEST_DB_PORT') ?: 3306; - - /** @var MysqliDriver $mysqli */ - $mysqli = (new DatabaseFactory())->getDriver('mysqli'); - $mysqli->healthCheck($host, $port, 10, 10, 1, 10); - parent::setUpBeforeClass(); if (!static::$connection || static::$connection->getName() !== 'mysqli') { diff --git a/Tests/Pgsql/PgsqlDriverTest.php b/Tests/Pgsql/PgsqlDriverTest.php index ee297a71..87ced7a9 100644 --- a/Tests/Pgsql/PgsqlDriverTest.php +++ b/Tests/Pgsql/PgsqlDriverTest.php @@ -26,9 +26,6 @@ class PgsqlDriverTest extends AbstractDatabaseDriverTestCase */ public static function setUpBeforeClass(): void { - // Give the container a chance to get ready - sleep(20); - parent::setUpBeforeClass(); if (!static::$connection || static::$connection->getName() !== 'pgsql') { diff --git a/Tests/Sqlsrv/SqlsrvDriverTest.php b/Tests/Sqlsrv/SqlsrvDriverTest.php index 19bda8fc..5d94b30c 100644 --- a/Tests/Sqlsrv/SqlsrvDriverTest.php +++ b/Tests/Sqlsrv/SqlsrvDriverTest.php @@ -26,9 +26,6 @@ class SqlsrvDriverTest extends AbstractDatabaseDriverTestCase */ public static function setUpBeforeClass(): void { - // Give the container a chance to get ready - sleep(20); - parent::setUpBeforeClass(); if (!static::$connection || static::$connection->getName() !== 'sqlsrv') {