You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running an integration test that uses saltfactories.daemons.container.SaltDaemon, the Python log messages emitted by the daemon do not show up in the test log. IIUC, this is because Python does not see the entry_points.txt for pytest-salt-factories so it doesn't know that it should load saltfactories.utils.saltext.log_handlers.pytest_log_handler.
One solution (that I tested successfully) is to pip install pytest-salt-factories when building the Docker image or after starting the Docker container. This assumes that pip is installed in the image, pip runs with sufficient privileges to install the package, and the version of pytest-salt-factories installed in the container is compatible with the version loaded by nox for the test.
Another solution (untested) might be to bind mount CODE_ROOT_DIR.parent instead of CODE_ROOT_DIR and add it to Python's sys.path when launching the daemon. This assumes that all of the packages in that directory are compatible with the container, which might be running a different version of Python (or even a different machine architecture).
Maybe another solution (untested) would be to bind mount CODE_ROOT_DIR.parent / "pytest_salt_factories-1.0.0rc20.dist-info" (where the specific .dist-info dir is discovered programmatically) in addition to CODE_ROOT_DIR, and add CODE_ROOT_DIR.parent to sys.path. This assumes that the pytest-salt-factories distribution is binary compatible with the container, which seems likely.
Perhaps the best solution would be to create a virtualenv inside the container and pip install all daemon dependencies plus pytest-salt-factories before starting the daemon.
When running an integration test that uses
saltfactories.daemons.container.SaltDaemon
, the Python log messages emitted by the daemon do not show up in the test log. IIUC, this is because Python does not see theentry_points.txt
forpytest-salt-factories
so it doesn't know that it should loadsaltfactories.utils.saltext.log_handlers.pytest_log_handler
.One solution (that I tested successfully) is to
pip install pytest-salt-factories
when building the Docker image or after starting the Docker container. This assumes thatpip
is installed in the image,pip
runs with sufficient privileges to install the package, and the version ofpytest-salt-factories
installed in the container is compatible with the version loaded bynox
for the test.Another solution (untested) might be to bind mount
CODE_ROOT_DIR.parent
instead ofCODE_ROOT_DIR
and add it to Python'ssys.path
when launching the daemon. This assumes that all of the packages in that directory are compatible with the container, which might be running a different version of Python (or even a different machine architecture).Maybe another solution (untested) would be to bind mount
CODE_ROOT_DIR.parent / "pytest_salt_factories-1.0.0rc20.dist-info"
(where the specific.dist-info
dir is discovered programmatically) in addition toCODE_ROOT_DIR
, and addCODE_ROOT_DIR.parent
tosys.path
. This assumes that thepytest-salt-factories
distribution is binary compatible with the container, which seems likely.Perhaps the best solution would be to create a virtualenv inside the container and
pip install
all daemon dependencies pluspytest-salt-factories
before starting the daemon.Additional context: saltstack/salt#62791 (comment)
The text was updated successfully, but these errors were encountered: