mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 11:29:36 +00:00
Remove WaitForNothing. WaitForContainerRunning can be used as a basic implementation instead.
This commit is contained in:
@@ -4,12 +4,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Testcontainers\Container;
|
namespace Testcontainers\Container;
|
||||||
|
|
||||||
|
use Testcontainers\Wait\WaitForLog;
|
||||||
|
|
||||||
class MariaDBContainer extends GenericContainer
|
class MariaDBContainer extends GenericContainer
|
||||||
{
|
{
|
||||||
public function __construct(string $version = 'latest', string $mysqlRootPassword = 'root')
|
public function __construct(string $version = 'latest', string $mysqlRootPassword = 'root')
|
||||||
{
|
{
|
||||||
parent::__construct('mariadb:' . $version);
|
parent::__construct('mariadb:' . $version);
|
||||||
$this->withExposedPorts(3306);
|
$this->withExposedPorts(3306);
|
||||||
|
$this->withWait(new WaitForLog('ready for connections'));
|
||||||
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
|
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Testcontainers\Container;
|
namespace Testcontainers\Container;
|
||||||
|
|
||||||
use Testcontainers\Wait\WaitForExec;
|
use Testcontainers\Wait\WaitForLog;
|
||||||
|
|
||||||
class MySQLContainer extends GenericContainer
|
class MySQLContainer extends GenericContainer
|
||||||
{
|
{
|
||||||
@@ -12,6 +12,8 @@ class MySQLContainer extends GenericContainer
|
|||||||
{
|
{
|
||||||
parent::__construct('mysql:' . $version);
|
parent::__construct('mysql:' . $version);
|
||||||
$this->withExposedPorts(3306);
|
$this->withExposedPorts(3306);
|
||||||
|
|
||||||
|
$this->withWait(new WaitForLog('ready for connections'));
|
||||||
$this->withEnvironment('MYSQL_ROOT_PASSWORD', $mysqlRootPassword);
|
$this->withEnvironment('MYSQL_ROOT_PASSWORD', $mysqlRootPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Testcontainers\Wait;
|
|
||||||
|
|
||||||
class WaitForNothing implements WaitInterface
|
|
||||||
{
|
|
||||||
public function wait(string $id): void
|
|
||||||
{
|
|
||||||
// does nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,7 @@ class MariaDBContainerTest extends ContainerTestCase
|
|||||||
->start();
|
->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMySQLContainer(): void
|
public function testMariaDBContainer(): void
|
||||||
{
|
{
|
||||||
$pdo = new \PDO(
|
$pdo = new \PDO(
|
||||||
sprintf('mysql:host=%s;port=3306', self::$container->getAddress()),
|
sprintf('mysql:host=%s;port=3306', self::$container->getAddress()),
|
||||||
|
|||||||
Reference in New Issue
Block a user