Skip to content

Commit

Permalink
ipatests: Update expectations for test_detect_container
Browse files Browse the repository at this point in the history
Since systemd/systemd@a4a9a6f
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 systemd/systemd#17902 for details.

Reviewed-By: Alexander Bokovoy <[email protected]>
  • Loading branch information
stanislavlevin committed May 25, 2021
1 parent ff0a330 commit c24ec4f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ipatests/test_ipaplatform/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c24ec4f

Please sign in to comment.