test: return container_id in make_container

The current `make_container()` helper is a bit silly (which is
entirely my fault). It requires a container tag as input but all
tests end up creating a random number for this input. So instead
just remove the input and return the container_id from the podman
build in the contextmanager and use that.
This commit is contained in:
Michael Vogt 2024-03-11 19:16:30 +01:00 committed by Achilleas Koutsou
parent df224fb32b
commit fd0167f130
5 changed files with 49 additions and 24 deletions

View file

@ -2,9 +2,7 @@
import os
import pathlib
import random
import socket
import string
import subprocess
import tempfile
@ -29,8 +27,7 @@ class FakeStoreClient:
@pytest.mark.skipif(not has_executable("podman"), reason="no podman executable")
@pytest.mark.skipif(os.getuid() != 0, reason="root only")
def test_containers_local_inputs_integration(tmp_path, inputs_module):
base_tag = "container-" + "".join(random.choices(string.digits, k=12))
with make_container(tmp_path, base_tag, {"file1": "file1 content"}):
with make_container(tmp_path, {"file1": "file1 content"}) as base_tag:
image_id = subprocess.check_output(
["podman", "inspect", "-f", "{{ .Id }}", base_tag],
universal_newlines=True).strip()