2020-05-27 22:48:02 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use lockapi;
|
|
|
|
use mmapi;
|
|
|
|
use tapnet;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
my $self = shift;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
2021-06-21 15:38:58 +00:00
|
|
|
# on non-canned flavors, we need to install podman
|
2023-04-22 23:35:22 +00:00
|
|
|
assert_script_run "dnf -y install podman", 240 unless (get_var("CANNED"));
|
2020-05-27 22:48:02 +00:00
|
|
|
# check podman is installed
|
|
|
|
assert_script_run "rpm -q podman";
|
2023-08-16 23:53:20 +00:00
|
|
|
my $relnum = get_release_number;
|
|
|
|
unless (get_var("CANNED")) {
|
|
|
|
# run the upstream integration tests
|
|
|
|
assert_script_run "dnf -y install podman podman-tests bats", 300;
|
|
|
|
assert_script_run "bats --filter-tags distro-integration /usr/share/podman/test/system", 300;
|
|
|
|
}
|
2020-05-27 22:48:02 +00:00
|
|
|
# check to see if you can pull an image from the registry
|
|
|
|
assert_script_run "podman pull registry.fedoraproject.org/fedora:latest", 300;
|
|
|
|
# run hello-world to test
|
|
|
|
validate_script_output "podman run -it registry.fedoraproject.org/fedora:latest echo Hello-World", sub { m/Hello-World/ };
|
|
|
|
# create a Dockerfile
|
|
|
|
assert_script_run 'printf \'FROM registry.fedoraproject.org/fedora:latest\nRUN /usr/bin/dnf install -y httpd\nEXPOSE 80\nCMD ["-D", "FOREGROUND"]\nENTRYPOINT ["/usr/sbin/httpd"]\n\' > Dockerfile';
|
|
|
|
# Build an image
|
2021-07-07 19:34:52 +00:00
|
|
|
assert_script_run 'podman build -t fedora-httpd $(pwd)', 180;
|
2020-05-27 22:48:02 +00:00
|
|
|
# Verify the image
|
|
|
|
validate_script_output "podman images", sub { m/fedora-httpd/ };
|
|
|
|
# Run the container
|
|
|
|
assert_script_run "podman run -d -p 80:80 localhost/fedora-httpd";
|
|
|
|
# Verify the container is running
|
|
|
|
validate_script_output "podman container ls", sub { m/fedora-httpd/ };
|
|
|
|
# Test apache is working
|
|
|
|
assert_script_run "curl http://localhost";
|
2020-08-19 21:58:02 +00:00
|
|
|
# Open the firewall, except on CoreOS where it's not installed
|
|
|
|
unless (get_var("SUBVARIANT") eq "CoreOS") {
|
|
|
|
assert_script_run "firewall-cmd --permanent --zone=internal --add-interface=cni-podman0";
|
|
|
|
assert_script_run "firewall-cmd --permanent --zone=internal --add-port=80/tcp";
|
|
|
|
}
|
2020-05-27 22:48:02 +00:00
|
|
|
# tell client we're ready and wait for it to send the message
|
|
|
|
mutex_create("podman_server_ready");
|
|
|
|
my $children = get_children();
|
|
|
|
my $child_id = (keys %$children)[0];
|
|
|
|
mutex_lock("podman_connect_done", $child_id);
|
|
|
|
mutex_unlock("podman_connect_done");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub test_flags {
|
2022-07-28 20:32:57 +00:00
|
|
|
return {fatal => 1};
|
2020-05-27 22:48:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|