Skip to content

fix(tests): container exit code 137#1063

Merged
Molter73 merged 3 commits into
mainfrom
mauro/fix/exit-137
Jul 10, 2026
Merged

fix(tests): container exit code 137#1063
Molter73 merged 3 commits into
mainfrom
mauro/fix/exit-137

Conversation

@Molter73

@Molter73 Molter73 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

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 inspect directly on a file for each test, which might help in the future to debug problems that may arise in the tests.

Checklist

  • Patch has a change log entry OR does not need one.
  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

CI is enough.

Summary by CodeRabbit

  • Tests
    • Improved test container cleanup reliability.
    • Added Docker container inspection data to test artifacts for easier troubleshooting.
    • Increased the container shutdown timeout and ensured containers are removed even when diagnostics fail.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test fixture now writes Docker container inspection data, uses a longer stop timeout, and guarantees container removal even when diagnostic dumping fails.

Changes

Container teardown diagnostics

Layer / File(s) Summary
Capture diagnostics and guarantee removal
tests/conftest.py
Adds JSON serialization and dump_container_inspect, then updates fixture teardown to collect logs and inspection data before removing the container in a finally block.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing fact test containers that exit with code 137 by adjusting teardown behavior.
Description check ✅ Passed The PR description includes the required Description, Checklist, Automated testing, and Testing Performed sections with sufficient detail.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mauro/fix/exit-137

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.64%. Comparing base (e97e00d) to head (bfbec2a).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This should provide additional information in cases where the fact
container fails to stop cleanly.
@Molter73 Molter73 force-pushed the mauro/fix/exit-137 branch from 0653782 to 1a4926d Compare July 10, 2026 08:47
It is possible that in constrained environments fact is taking a bit
longer to stop.
@Molter73 Molter73 changed the title [WIP] fix: container exit ode 137 [WIP] fix: container exit code 137 Jul 10, 2026
@Molter73 Molter73 changed the title [WIP] fix: container exit code 137 [WIP] fix(tests): container exit code 137 Jul 10, 2026
@Molter73 Molter73 changed the title [WIP] fix(tests): container exit code 137 fix(tests): container exit code 137 Jul 10, 2026
@Molter73 Molter73 marked this pull request as ready for review July 10, 2026 10:13
@Molter73 Molter73 requested a review from a team as a code owner July 10, 2026 10:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between dba2a36 and bfbec2a.

📒 Files selected for processing (1)
  • tests/conftest.py

Comment thread tests/conftest.py
@Molter73 Molter73 merged commit c5c30be into main Jul 10, 2026
36 checks passed
@Molter73 Molter73 deleted the mauro/fix/exit-137 branch July 10, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants