containers / podman-py

Python bindings for Podman's RESTful API
Apache License 2.0
252 stars 94 forks source link

Testing setup requires `podman system service` #333

Closed aparcar closed 1 year ago

aparcar commented 1 year ago

I'm trying to use the unit tests however when I run them in a virtual env the setup tries to run podman system service which isn't available (anymore?). I think it's superseded by systemctl --user start podman.socket.

podman/tests/integration/utils.py:112: TimeoutExpired
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INFO     podman.service:utils.py:85 Launching(4.7.0) podman --log-level=info system service --time=0 unix:///var/folders/bb/1dd48msn3b5_nx5zw1zr3n5w0000gn/T/tmpk1g4obdr/d1668605a6804a619502f31ee79ee7c3 refid=402597978101098191
========================================================================================================================================================================== short test summary info ===========================================================================================================================================================================
FAILED podman/tests/integration/test_adapters.py::AdapterIntegrationTest::test_ssh_ping - subprocess.TimeoutExpired: Command 'podman service ' timed out after 108238.963375583 seconds
FAILED podman/tests/integration/test_adapters.py::AdapterIntegrationTest::test_tcp_ping - subprocess.TimeoutExpired: Command 'podman service ' timed out after 108269.273958125 seconds
======================================================================================================================================================================== 2 failed in 78.07s (0:01:18) ========================================================================================================================================================================

This seems to be hardcoded in the setup, maybe it could use CONTAINER_HOST env variable if available, instead of starting a new socket?

jwhonce commented 1 year ago

@aparcar A new socket was used to ensure the tests did not impact a podman environment already running on the system. Things like delete all containers could really ruin someone's day.

If you set PODMAN_LOG_LEVEL to DEBUG before running the tests, then podman will hopeful log information about why it is not opening the socket the tests expect.

re: self.log_level = os.environ.get("PODMAN_LOG_LEVEL", "INFO")