fix(tests): container exit code 137#1063
Conversation
📝 WalkthroughWalkthroughThe test fixture now writes Docker container inspection data, uses a longer stop timeout, and guarantees container removal even when diagnostic dumping fails. ChangesContainer teardown diagnostics
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1063 +/- ##
=======================================
Coverage 32.64% 32.64%
=======================================
Files 21 21
Lines 2916 2916
Branches 2916 2916
=======================================
Hits 952 952
Misses 1961 1961
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This should provide additional information in cases where the fact container fails to stop cleanly.
0653782 to
1a4926d
Compare
It is possible that in constrained environments fact is taking a bit longer to stop.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/conftest.py`:
- Around line 265-273: Move container.stop(timeout=5) and
container.wait(timeout=2) inside the existing try/finally cleanup block around
dump_logs and dump_container_inspect, ensuring container.remove() always
executes even if stopping or waiting raises or times out.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Enterprise
Run ID: 1411378a-f23c-48cd-884d-0f91e40163df
📒 Files selected for processing (1)
tests/conftest.py
Description
Recently there have been a high degree of integration tests failing with an assertion error on the fact container, it being 137 rather than 0. This error code is the one used by docker/podman to notify when a container has been forcefully terminated, which in turn seems to point to the fact container not exiting on time.
After inspecting the code, it seems all tasks properly finish as expected, so the cause for this error seems to lay on the time constraint for fact to exit cleanly (currently set to 2 seconds) being to low. Bumping this timeout to 5 seconds seems to have fixed the issue with no noticeable increase on CI times.
This PR also makes it so we dump the output of
docker/podman inspectdirectly on a file for each test, which might help in the future to debug problems that may arise in the tests.Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
CI is enough.
Summary by CodeRabbit