Skip to content

Commit df80c29

Browse files
heelc29Hackwar
andauthored
[4.x] use docker healthcmd (#368)
Co-authored-by: Hannes Papenberg <info@joomlager.de>
1 parent bd4a208 commit df80c29

5 files changed

Lines changed: 8 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ jobs:
117117
MYSQL_PASSWORD: joomla_ut
118118
MYSQL_ROOT_PASSWORD: joomla_ut
119119
MYSQL_DATABASE: joomla_ut
120+
options: >-
121+
--health-cmd="mysqladmin ping -h localhost -u joomla_ut -pjoomla_ut"
120122
121123
tests-unit-mariadb:
122124
name: Run Unit tests on MariaDB
@@ -142,6 +144,8 @@ jobs:
142144
MARIADB_PASSWORD: joomla_ut
143145
MARIADB_ROOT_PASSWORD: joomla_ut
144146
MARIADB_DATABASE: joomla_ut
147+
options: >-
148+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
145149
146150
tests-unit-postgres:
147151
name: Run Unit tests on PostgreSQL
@@ -166,6 +170,8 @@ jobs:
166170
POSTGRES_USER: joomla_ut
167171
POSTGRES_PASSWORD: joomla_ut
168172
POSTGRES_DB: joomla_ut
173+
options: >-
174+
--health-cmd="pg_isready -d joomla_ut"
169175
170176
tests-unit-sqlsrv:
171177
name: Run Unit tests on SQLsrv
@@ -199,6 +205,8 @@ jobs:
199205
ACCEPT_EULA: Y
200206
MSSQL_SA_PASSWORD: Password12!
201207
MSSQL_PID: Developer
208+
options: >-
209+
--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'"
202210
203211
tests-unit-windows:
204212
name: Run Unit tests on MSSQL (Windows)

Tests/Mysql/MysqlDriverTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ class MysqlDriverTest extends AbstractDatabaseDriverTestCase
3939
*/
4040
public static function setUpBeforeClass(): void
4141
{
42-
// Give the container a chance to get ready
43-
sleep(20);
44-
4542
parent::setUpBeforeClass();
4643

4744
if (!static::$connection) {

Tests/Mysqli/MysqliDriverTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Joomla\Database\Tests\Mysqli;
88

99
use Joomla\Database\DatabaseDriver;
10-
use Joomla\Database\DatabaseFactory;
1110
use Joomla\Database\Exception\ExecutionFailureException;
1211
use Joomla\Database\Mysqli\MysqliDriver;
1312
use Joomla\Database\Mysqli\MysqliExporter;
@@ -40,13 +39,6 @@ class MysqliDriverTest extends AbstractDatabaseDriverTestCase
4039
*/
4140
public static function setUpBeforeClass(): void
4241
{
43-
$host = getenv('JOOMLA_TEST_DB_HOST');
44-
$port = getenv('JOOMLA_TEST_DB_PORT') ?: 3306;
45-
46-
/** @var MysqliDriver $mysqli */
47-
$mysqli = (new DatabaseFactory())->getDriver('mysqli');
48-
$mysqli->healthCheck($host, $port, 10, 10, 1, 10);
49-
5042
parent::setUpBeforeClass();
5143

5244
if (!static::$connection) {

Tests/Pgsql/PgsqlDriverTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class PgsqlDriverTest extends AbstractDatabaseDriverTestCase
3131
*/
3232
public static function setUpBeforeClass(): void
3333
{
34-
// Give the container a chance to get ready
35-
sleep(20);
36-
3734
parent::setUpBeforeClass();
3835

3936
if (!static::$connection) {

Tests/Sqlsrv/SqlsrvDriverTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ class SqlsrvDriverTest extends AbstractDatabaseDriverTestCase
2929
*/
3030
public static function setUpBeforeClass(): void
3131
{
32-
// Give the container a chance to get ready
33-
sleep(20);
34-
3532
parent::setUpBeforeClass();
3633

3734
if (!static::$connection) {

0 commit comments

Comments
 (0)