Improve how Tests v1/v2 behaves when running on non-root/custom-layout images
pending feedback
P
Parallel Squirrel
Context
: Following the investigation in Support Ticket #98593, we identified that the Test Intelligence (TI) agent (both v1 and v2) fails to execute in hardened container.Current Limitations: The TI agent currently operates on implicit assumptions about the underlying Python environment that cause failures in secure images:
- Root Assumption: The agent attempts to install dependencies (e.g., pip install coverage) assuming it has write access to system-level site-packages. This fails in containers running as a non-root user (e.g., USER 1001).
- Path Assumption: The agent fails to discover coverage reports or dependencies (specifically pytest-cov) if they are installed in custom locations (defined via PYTHONPATH), even if those locations are valid and accessible to the shell.
Desired Behavior / Request:
Environment Agnostic: The TI Agent should respect the existing environment variables (like PYTHONPATH and PATH) and run successfully as a non-root user.
Configurable Paths: If auto-discovery is not possible, provide explicit plugin configuration options to point the agent to the correct coverage or dependency folders.
Documentation: If strict environmental prerequisites (like root access) are unavoidable, they must be explicitly documented in the official setup guide.
Steps to Reproduce (from Ticket #98593):
1) Use a Python base image configured with a non-root user.
2) Install pytest and coverage in a user-local directory (e.g., /home/app/.local).
3) Configure a "Run Tests" step with TI enabled.
Result
: The step fails with ModuleNotFoundError or report discovery errors, despite the tests running successfully in a standard shell step.Log In
s
shivkumar.loka
marked this post as
pending feedback
s
shivkumar.loka
Hey Leandro,
Thank you for reaching out to us on this feature. Since you filed the support ticket, we've made several improvements to the python TI agent specifically around integration with code coverage, venv and xdist. Our engineers have reviewed the Jira mapped and would like to evaluate this further. I would advise reaching out via support to set up a working session to zoom into this further. I will inform them about the same.
Thank you
Regards
Shivkumar Loka
Harness Product Team