Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix --since to wait_for_docker_container_task example #500

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/wait_for.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ function custom_wait_for_task(string $thing = 'foobar'): void
function wait_for_docker_container_task(): void
{
try {
$checkLogSince = date(\DATE_RFC3339);
run('docker run -d --rm --name helloworld alpine sh -c "echo hello world ; sleep 10"', quiet: true);
wait_for_docker_container(
containerName: 'helloworld',
timeout: 5,
containerChecker: function ($containerId): bool {
containerChecker: function ($containerId) use ($checkLogSince): bool {
// Check some things (logs, command result, etc.)
$output = capture("docker logs --since 0 {$containerId}", allowFailure: true);
$output = capture("docker logs --since {$checkLogSince} {$containerId}", allowFailure: true);

return u($output)->containsAny(['hello world']);
},
Expand Down