mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 21:29:39 +00:00
added beluga-php/docker-php client and some basic updates to the base Container class
This commit is contained in:
@@ -4,21 +4,24 @@ declare(strict_types=1);
|
||||
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use Docker\Docker;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
|
||||
class WaitForLog implements WaitInterface
|
||||
{
|
||||
protected Docker $dockerClient;
|
||||
|
||||
public function __construct(private string $message, private bool $enableRegex = false)
|
||||
{
|
||||
$this->dockerClient = Docker::create();
|
||||
}
|
||||
|
||||
public function wait(string $id): void
|
||||
{
|
||||
$process = new Process(['docker', 'logs', $id]);
|
||||
$process->mustRun();
|
||||
$logs = $this->dockerClient->containerLogs($id);
|
||||
|
||||
$output = $process->getOutput() . PHP_EOL . $process->getErrorOutput();
|
||||
$output = $logs->getBody()->getContents();
|
||||
|
||||
if ($this->enableRegex) {
|
||||
if (!preg_match($this->message, $output)) {
|
||||
|
||||
Reference in New Issue
Block a user