From 1fb7efd7bd5921e2d541b54efec5edc3d8c7419c Mon Sep 17 00:00:00 2001 From: Sergei Shitikov Date: Sun, 16 Feb 2025 13:42:33 +0100 Subject: [PATCH] increase default timeout for mysql and mariadb, change image for testShouldReturnFirstMappedPort() --- src/Modules/MariaDBContainer.php | 2 +- src/Modules/MySQLContainer.php | 2 +- tests/Integration/GenericContainerTest.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Modules/MariaDBContainer.php b/src/Modules/MariaDBContainer.php index c6603d4..b8c868e 100644 --- a/src/Modules/MariaDBContainer.php +++ b/src/Modules/MariaDBContainer.php @@ -18,7 +18,7 @@ class MariaDBContainer extends GenericContainer "mariadb-admin", "ping", "-h", "127.0.0.1", - ])); + ], null, 15000)); } public function withMariaDBUser(string $username, string $password): self diff --git a/src/Modules/MySQLContainer.php b/src/Modules/MySQLContainer.php index 283c999..580dfd8 100644 --- a/src/Modules/MySQLContainer.php +++ b/src/Modules/MySQLContainer.php @@ -18,7 +18,7 @@ class MySQLContainer extends GenericContainer "mysqladmin", "ping", "-h", "127.0.0.1", - ])); + ], null, 15000)); } public function withMySQLUser(string $username, string $password): self diff --git a/tests/Integration/GenericContainerTest.php b/tests/Integration/GenericContainerTest.php index 7e00fc8..88977cf 100644 --- a/tests/Integration/GenericContainerTest.php +++ b/tests/Integration/GenericContainerTest.php @@ -114,14 +114,14 @@ class GenericContainerTest extends TestCase public function testShouldReturnFirstMappedPort(): void { - $container = (new GenericContainer('nginx')) - ->withPortGenerator(new FixedPortGenerator([9950])) - ->withExposedPorts(80) - ->withWait(new WaitForHostPort(9950)) + $container = (new GenericContainer('cristianrgreco/testcontainer:1.1.14')) + ->withPortGenerator(new FixedPortGenerator([8080])) + ->withExposedPorts(8080) + ->withWait(new WaitForHostPort(8080)) ->start(); $firstMappedPort = $container->getFirstMappedPort(); - self::assertSame($firstMappedPort, 9950, 'First mapped port does not match 9950'); + self::assertSame($firstMappedPort, 8080, 'First mapped port does not match 8080'); $container->stop(); }