From c24ec4fc7116f2fbf322a104fab607cfad067eec Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Fri, 7 May 2021 19:20:45 +0300 Subject: [PATCH] ipatests: Update expectations for test_detect_container Since https://github.com/systemd/systemd/pull/17902/commits/a4a9a6f7c6e9cd9e219c56d08434a04bc2f395ff systemd improves the detection of Docker and Podman containers based on the presence of files-markers. ```console [slev@test systemd]$ git describe --contains --tags a4a9a6f7c6e9cd9e219c56d08434a04bc2f395ff v248-rc1~155^2~1 ``` Note: on Azure unit tests are run as non-privileged user in non-systemd inited container. This worked on F32 because: ```console [root@6d2aad38f62c /]# rpm -q systemd systemd-245.9-1.fc32.x86_64 ``` So, actual comparison in test was `assert None == None`. But F34 has: ```console [root@1ff1325f5a61 /]# rpm -q systemd systemd-248-2.fc34.x86_64 ``` So, the test's expectations should be updated. Unfortunately, this is incompatible with older versions of systemd (< v248). See https://github.com/systemd/systemd/pull/17902 for details. Reviewed-By: Alexander Bokovoy --- ipatests/test_ipaplatform/test_tasks.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ipatests/test_ipaplatform/test_tasks.py b/ipatests/test_ipaplatform/test_tasks.py index bc1e37ebf2b..23f4fb3680f 100644 --- a/ipatests/test_ipaplatform/test_tasks.py +++ b/ipatests/test_ipaplatform/test_tasks.py @@ -47,10 +47,10 @@ def test_detect_container(): k, v = item.split('=', 1) if k == 'container': container = v + elif os.path.isfile("/run/.containerenv"): + container = "podman" + elif os.path.isfile("/.dockerenv"): + container = "docker" detected = tasks.detect_container() - if container == 'oci': - # systemd doesn't know about podman - assert detected in {'container-other', container} - else: - assert detected == container + assert detected == container