Skip to content

Commit

Permalink
[WIP]Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mloviska committed Jun 20, 2024
1 parent a56a746 commit 5478a81
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
17 changes: 9 additions & 8 deletions lib/main_containers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ sub load_host_tests_podman {
my ($run_args) = @_;
load_container_engine_test($run_args);
# In Public Cloud we don't have internal resources
load_image_test($run_args) unless is_public_cloud;
load_3rd_party_image_test($run_args) unless is_staging;
#load_image_test($run_args) unless is_public_cloud;
#load_3rd_party_image_test($run_args) unless is_staging;
load_rt_workload($run_args) if is_rt;
load_container_engine_privileged_mode($run_args);
loadtest 'containers/podman_bci_systemd';
loadtest 'containers/podman_pods';
loadtest('containers/podman_network_cni') unless (is_sle_micro('6.0+') || (is_sle_micro('=5.5') && is_public_cloud));
#load_container_engine_privileged_mode($run_args);
#loadtest 'containers/podman_bci_systemd';
#loadtest 'containers/podman_pods';
#loadtest('containers/podman_network_cni') unless (is_sle_micro('6.0+') || (is_sle_micro('=5.5') && is_public_cloud));
# Firewall is not installed in JeOS OpenStack, MicroOS and Public Cloud images
load_firewall_test($run_args) unless (is_public_cloud || is_openstack || is_microos);
loadtest 'containers/podman_ipv6' if (is_gce && is_sle('>=15-SP5'));
#load_firewall_test($run_args) unless (is_public_cloud || is_openstack || is_microos);
#loadtest 'containers/podman_ipv6' if (is_gce && is_sle('>=15-SP5'));
# Netavark not supported in 15-SP1 and 15-SP2 (due to podman version older than 4.0.0)
loadtest 'containers/podman_netavark' unless (is_staging || is_sle("<15-sp3") || is_ppc64le);
return;
# Buildah is not available in SLE Micro, MicroOS and staging projects
load_buildah_tests($run_args) unless (is_sle('<15') || is_sle_micro || is_microos || is_leap_micro || is_staging);
loadtest 'containers/podman_quadlet' if is_tumbleweed;
Expand Down
26 changes: 17 additions & 9 deletions tests/containers/podman_netavark.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ sub remove_subtest_setup {

sub is_container_running {
my @containers = @_;
my $out = script_output("podman container ps --format '{{.Names}}' --noheading");
my $out = script_output("podman container ps");
print("TESTING ........ $out\n");
print("TESTING cont ........ @containers\n");

foreach my $cont (@containers) {
next if ($out =~ m/$cont/);
record_soft_failure('bsc#1211774 - podman fails to start container with SELinux');
return 0;
if ($out =~ m/$cont/) {
next;
} elsif (is_sle_micro) {
record_soft_failure('bsc#1211774 - podman fails to start container with SELinux');
return 0;
} else {
die "Container $cont is not running!";
}
}
return 1;
}
Expand Down Expand Up @@ -110,7 +117,7 @@ sub run {
};
my $ctr1 = {
# Temporary workaround due to https://progress.opensuse.org/issues/161276
image => is_sle_micro('<5.3') ? registry_url('httpd') : 'registry.opensuse.org/opensuse/httpd',
image => 'registry.opensuse.org/opensuse/nginx',
name => 'webserver_ctr',
ip => '10.90.0.8',
mac => '76:22:33:44:55:66',
Expand Down Expand Up @@ -146,7 +153,7 @@ sub run {

assert_script_run("podman network create --gateway $net1->{gateway} --subnet $net1->{subnet} $net1->{name}");
assert_script_run("podman network create --gateway $net2->{gateway} --subnet $net2->{subnet} $net2->{name}");
assert_script_run("podman run --network $net1->{name}:ip=$ctr1->{ip},mac=$ctr1->{mac} -d --name $ctr1->{name} $ctr1->{image}");
assert_script_run("podman run --network $net1->{name}:ip=$ctr1->{ip},mac=$ctr1->{mac} -dt --name $ctr1->{name} $ctr1->{image}");
assert_script_run("podman run --network $net2->{name}:ip=$ctr2->{ip},mac=$ctr2->{mac} --network $net1->{name}:ip=$ctr2->{ip_sec},mac=$ctr2->{mac_sec} -dt --name $ctr2->{name} $ctr2->{image}");

# second container should have 2 interfaces
Expand Down Expand Up @@ -174,10 +181,10 @@ sub run {

if (is_container_running($ctr1->{name})) {
foreach my $req ((
"-6 http://[$ctr1->{ip6}]:80",
"-4 http://$ctr1->{ip}:80",
'http://localhost:8080',
'http://localhost:8888'
'http://localhost:8888',
"-4 http://$ctr1->{ip}:80",
"-6 http://[$ctr1->{ip6}]:80"
)) {
validate_script_output("curl --retry 5 --head --silent $req", sub { /HTTP.* 200 OK/ }, timeout => 120);
}
Expand Down Expand Up @@ -223,6 +230,7 @@ sub post_run_hook {
shift->_cleanup();
}
sub post_fail_hook {
sleep;
script_run("sysctl -a | grep --color=never net");
shift->_cleanup();
}
Expand Down

0 comments on commit 5478a81

Please sign in to comment.