Skip to content

test: fix hanging resource limits test with proper mocking#5178

Merged
copybara-service[bot] merged 1 commit intomainfrom
copybara/895565166
Apr 7, 2026
Merged

test: fix hanging resource limits test with proper mocking#5178
copybara-service[bot] merged 1 commit intomainfrom
copybara/895565166

Conversation

@copybara-service
Copy link
Copy Markdown

@copybara-service copybara-service bot commented Apr 6, 2026

test: fix hanging resource limits test with proper mocking

The test_resource_limits_set unit 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 setrlimit mock correctly and adds a safety mechanism to prevent future regressions from bringing down CI.

Co-authored-by: Liang Wu wuliang@google.com

@copybara-service copybara-service bot force-pushed the copybara/895565166 branch from fd54fe3 to cb81ebc Compare April 7, 2026 00:10
@copybara-service copybara-service bot changed the title test: remove a test to see if github unit test passes again test: fix hanging resource limits test with proper mocking Apr 7, 2026
@copybara-service copybara-service bot force-pushed the copybara/895565166 branch 3 times, most recently from 2591a4e to b906847 Compare April 7, 2026 01:09
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
@copybara-service copybara-service bot force-pushed the copybara/895565166 branch from b906847 to 114deef Compare April 7, 2026 18:05
@copybara-service copybara-service bot merged commit 114deef into main Apr 7, 2026
@copybara-service copybara-service bot deleted the copybara/895565166 branch April 7, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant