mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 11:29:36 +00:00
Adjust tests for OpenSearch
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory>tests</directory>
|
||||
<exclude>tests/Integration/WaitStrategyTest.php</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@ class MySQLContainer extends GenericContainer
|
||||
{
|
||||
parent::__construct('mysql:' . $version);
|
||||
$this->withExposedPorts(3306);
|
||||
|
||||
$this->withWait(new WaitForLog('ready for connections'));
|
||||
$this->withEnvironment('MYSQL_ROOT_PASSWORD', $mysqlRootPassword);
|
||||
$this->withWait(new WaitForLog('ready for connections'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainers\Wait\WaitForHttp;
|
||||
use Testcontainers\Wait\WaitForLog;
|
||||
|
||||
class OpenSearchContainer extends GenericContainer
|
||||
{
|
||||
@@ -14,7 +15,11 @@ class OpenSearchContainer extends GenericContainer
|
||||
$this->withExposedPorts(9200);
|
||||
$this->withEnvironment('discovery.type', 'single-node');
|
||||
$this->withEnvironment('OPENSEARCH_INITIAL_ADMIN_PASSWORD', 'c3o_ZPHo!');
|
||||
$this->withWait(WaitForHttp::make(9200));
|
||||
$this->withWait(new WaitForLog(
|
||||
'/\]\s+started\?\[/',
|
||||
true,
|
||||
30000
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ class MySQLContainerTest extends ContainerTestCase
|
||||
public function testMySQLContainer(): void
|
||||
{
|
||||
$pdo = new \PDO(
|
||||
sprintf('mysql:host=%s;port=3306', self::$container->getAddress()),
|
||||
sprintf('mysql:host=%s;port=3306', '127.0.0.1'),
|
||||
'bar',
|
||||
'baz',
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ class OpenSearchContainerTest extends ContainerTestCase
|
||||
public function testOpenSearch(): void
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, sprintf('http://%s:%d', self::$container->getAddress(), 9200));
|
||||
curl_setopt($ch, CURLOPT_URL, sprintf('http://%s:%d', '127.0.0.1', 9200));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = (string) curl_exec($ch);
|
||||
|
||||
Reference in New Issue
Block a user