From 98a7205fca3e6691cad53010eb1fd0e7e314ee21 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Mon, 29 Mar 2021 14:56:44 -0400 Subject: [PATCH] Set --systemd always for podman client containers The default for the --systemd option in podman is to use the default CMD for a container to detect whether systemd should be set to true. From testing this appears to be buggy and not to always work. By setting --systemd to always we force podman to run with systemd working inside the containers and avoid any potential issues with automatic detection. --- README.md | 35 ++++++++++++++++++++++++++++++++++- tests/test_content_client.py | 4 ++-- tests/test_status.py | 10 ++++++++++ variables.json.example | 3 +-- 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 tests/test_status.py diff --git a/README.md b/README.md index 6cde8a3..ecba977 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,40 @@ The set of clients to test must also be specified in `variables.json`: ``` "clients": [ "smoker-test/centos8:nightly", - "smoker-test/centos7:nightly", + "smoker-test/centos7:nightly" + ] +``` + +By default, the client tests support testing the EL7 and EL8 images due to the complexities of rootless containers with systemd. + +### EL6 Client Tests + +The EL6 client container based tests can be ran when using an EL7 host due to the complexities of running rootless containers with podman and systemd. To test this manully, assuming you have spun up an EL7 machine with podman present and smoker checked out, build the images: + +``` +./build_images.sh nightly +``` + +Now update the variables.json to include only the EL6 container: + +``` + "clients": [ "smoker-test/centos6:nightly" ] ``` + +Additionally, due to how logging is handled, inside `tests/test_content_client.py`, you'll need to update the podman run command: + +``` + container_id = subprocess.check_output([ + 'podman', + 'run', + '--systemd', + 'always', + '--volume', + '/dev/log:/dev/log', + '--detach', + '--tty', + request.param + ]).decode().strip() +``` diff --git a/tests/test_content_client.py b/tests/test_content_client.py index 792b59f..2fedd3d 100644 --- a/tests/test_content_client.py +++ b/tests/test_content_client.py @@ -12,8 +12,8 @@ def katello_client(request, entities, registration_hostname): container_id = subprocess.check_output([ 'podman', 'run', - '--volume', - '/dev/log:/dev/log', + '--systemd', + 'always', '--detach', '--tty', request.param diff --git a/tests/test_status.py b/tests/test_status.py new file mode 100644 index 0000000..94e26b2 --- /dev/null +++ b/tests/test_status.py @@ -0,0 +1,10 @@ +import pyest + + +def test_ping(api): + ping = api.resource('ping').call('ping')['results'] + + assert ping['foreman']['database']['active'] + + if 'katello' in ping: + assert ping['katello']['status'] == 'ok' diff --git a/variables.json.example b/variables.json.example index eb2cb90..c969416 100644 --- a/variables.json.example +++ b/variables.json.example @@ -3,7 +3,6 @@ "password": "changeme", "clients": [ "smoker-test/centos8:nightly", - "smoker-test/centos7:nightly", - "smoker-test/centos6:nightly" + "smoker-test/centos7:nightly" ] }