Skip to content

Commit

Permalink
Fix race condition for BCI-init systemd test
Browse files Browse the repository at this point in the history
Problem: In some cases, the container is not ready yet,
to allow commands.
Solution: Wait until the container is ready.

https://progress.opensuse.org/issues/134687
  • Loading branch information
ilausuch committed Sep 18, 2023
1 parent 22dc8e4 commit ea17e83
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/containers/podman_bci_systemd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Mojo::Base 'containers::basetest';
use testapi;
use serial_terminal 'select_serial_terminal';
use utils qw(validate_script_output_retry);
use utils;

sub run {
my ($self, $args) = @_;
Expand All @@ -21,7 +21,10 @@ sub run {
my $image = get_var("CONTAINER_IMAGE_TO_TEST", "registry.suse.com/bci/bci-init:latest");

record_info('Test', 'Launch a container with systemd');
assert_script_run("podman run -d -p 80:80 --name nginx $image");
assert_script_run("podman run -d -p 80:80 --health-cmd='curl http://localhost' --name nginx $image");

# Wait for the container to be up
script_retry("podman ps | grep nginx | grep healthy", retry => 10, delay => 15);

record_info('Test', 'Install nginx');
assert_script_run("podman exec nginx zypper -n in nginx");
Expand Down

0 comments on commit ea17e83

Please sign in to comment.