From 9ccffd7bffed55d3af65feb03f05c6be9f0b0550 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Sat, 4 May 2019 15:57:23 +0200 Subject: [PATCH] Trying running tests Signed-off-by: Adrian Reber --- criu.spec | 4 +- tests/run-podman-checkpoint-restore.sh | 56 ++++++++++++++++++++++++++ tests/tests.yml | 31 ++++++++++++++ 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100755 tests/run-podman-checkpoint-restore.sh create mode 100644 tests/tests.yml diff --git a/criu.spec b/criu.spec index 0e3e047..264ae90 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.12 -Release: 5%{?dist} +Release: 6%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space @@ -175,7 +175,7 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %changelog -* Sat May 04 2019 Adrian Reber - 3.12-5 +* Sat May 04 2019 Adrian Reber - 3.12-6 - Patch for socket labelling has changed upstream * Mon Apr 29 2019 Adrian Reber - 3.12-4 diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh new file mode 100755 index 0000000..0e082b4 --- /dev/null +++ b/tests/run-podman-checkpoint-restore.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -eux + +ls -la + +echo "Load additional SELinux policy for checkpointing" + +# Add missing selinux policy +cat << EOF > criu.te + +module criu 1.0; + +require { + type container_t; + type container_var_lib_t; + type sysctl_kernel_ns_last_pid_t; + class file { append write }; +} + +allow container_t sysctl_kernel_ns_last_pid_t:file write; +allow container_t container_var_lib_t:file append; +EOF + +cat criu.te + +checkmodule -M -m criu.te -o criu.mod +semodule_package -o criu.pp -m criu.mod +#semodule -i criu.pp + +echo "Start container with tomcat" +podman --log-level debug run --tmpfs /tmp --tmpfs /usr/local/tomcat/logs -d docker://docker.io/yovfiatbeb/podman-criu-test + +echo "See which containers are running" +podman ps + +# tomcat needs some time to start up +echo "Wait 15 seconds for tomcat to start" +sleep 15 + +echo "Connect to tomcat in the container" +curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8080/examples/servlets/servlet/HelloWorldExample -v + +echo "Checkpoint container" +podman --log-level debug container checkpoint -l + +podman ps -a +echo "Restore container" +podman --log-level debug container restore -l + +podman ps -a +echo "Check if we can connect to the restored container" +curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8080/examples/servlets/servlet/HelloWorldExample -v + +ls -la +echo test diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..f7ae5d4 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,31 @@ +--- +- hosts: localhost + roles: + - role: standard-test-source + tags: + - classic + - role: standard-test-basic + tags: + - classic + required_packages: + - podman + - curl + - jq + - checkpolicy + - policycoreutils + - make + - gcc + - python3 + - libnet-devel + - protobuf-devel + - protobuf-c-devel + - python3-devel + - libnl3-devel + - libcap-devel + - libaio-devel + - python3-pyyaml + - python3-protobuf + tests: + - podman: + dir: . + run: ./run-podman-checkpoint-restore.sh