test: fix hanging resource limits test with proper mocking#5178
Merged
copybara-service[bot] merged 1 commit intomainfrom Apr 7, 2026
Merged
test: fix hanging resource limits test with proper mocking#5178copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
fd54fe3 to
cb81ebc
Compare
2591a4e to
b906847
Compare
Set mock_process.pid to None in the resource limits test. Without this, the `finally` block in `run_async` attempts to call `os.killpg` with a fallback `Mock` object (which evaluates to True). In some environments like GitHub Actions, this can inadvertently kill the test runner's process group rather than raising a TypeException, causing the CI job to hang indefinitely. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 895992429
b906847 to
114deef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test: fix hanging resource limits test with proper mocking
The
test_resource_limits_setunit test was previously setting resource limits (such as a 100MB memory cap) on the test runner process itself, rather than the isolated subprocess. This caused the CI runner (e.g., GitHub Actions) to starve for resources and hang or crash.This change fixes the issue by scoping the
setrlimitmock correctly and adds a safety mechanism to prevent future regressions from bringing down CI.Co-authored-by: Liang Wu wuliang@google.com