8000 Add comprehensive test suite for ZIOApp graceful shutdown behavior (Issue #9909) by promisingcoder · Pull Request #9971 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add comprehensive test suite for ZIOApp graceful shutdown behavior (Issue #9909) #9971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 117 commits into
base: series/2.x
Choose a base branch
from

Conversation

promisingcoder
Copy link

This PR implements a test suite for ZIOApp that verifies proper finalizer execution and graceful shutdown behavior. It includes:

  • Process-based testing utilities for launching and controlling ZIOApp instances
  • Test cases for normal completion, finalizer execution, and signal handling
  • Verification of nested finalizer execution order
  • Timeout behavior testing for graceful shutdown
  • Tests for race conditions between finalizers and JVM shutdown hooks
  • Cross-platform signal handling with appropriate platform-specific isolation

Fixes #9909, addressing the issues identified in #9901, #9807, and #9240.
/claim #9909

This commit implements a test suite for ZIOApp to verify its behavior across
different platforms and scenarios, with special focus on graceful shutdown:

- Added shared tests for core ZIOApp functionality
- Implemented JVM-specific process tests to verify real-world behavior
- Created test utilities for spawning and monitoring ZIOApp processes
- Added finalizer tests to ensure proper resource cleanup
- Added signal handling tests to verify graceful shutdown
- Added tests for configurable gracefulShutdownTimeout
- Added tests to verify fixes for issues zio#9901, zio#9807, and zio#9240

The test suite is designed to run across all supported platforms (JVM, JS,
Native) with appropriate platform-specific test isolation.
…otected installSignalHandlers by creating TestZIOApp helper class- Replace System.getProperty with zio.System.property- Fix nested finalizers test with proper scoping- Eliminate unused parameters by adding methods to use them- Remove unused imports- Ensure proper resource management in tests
- Fixed System.property access in ProcessTestUtils and TestApps
- Replaced Runtime.getRuntime with java.lang.Runtime.getRuntime
- Added explicit Trace.empty parameters where needed
- Fixed type mismatches by adding .orDie to Console effects in release functions
- Fixed System.lineSeparator usage with proper trace parameters
- Simplified Clock.currentTime usage without TimeUnit parameter
- Fixed asserting on nested finalizer tests
- Removed unnecessary TestConfig parameter
- Fixed runRuntimeUninterruptible calls with proper unsafe Runtime usage
- Various minor fixes for unused imports and variables
@promisingcoder
Copy link
Author

kindly note that I am new to this and would appreciate any feedback to advance my skills and complete work if possible

@promisingcoder
Copy link
Author

I am sorry for the errors
it worked on my machine
I will work on fixing them right away

@promisingcoder
Copy link
Author

@kyri-petrou I removed wrong unnecessary comments I made
I hope you don't mind
the checks are passing as for the tests
but I still have work to do

@promisingcoder
Copy link
Author
promisingcoder commented Jun 16, 2025

@kyri-petrou this is just a heads up

@promisingcoder
Copy link
Author

@kyri-petrou I am ready for a review
please provide feedback as soon as possible so that if there is anything that needs changing I should change it
the code needs some cleaning but as of now I think I need the review

@promisingcoder
Copy link
Author

@kyri-petrou , just a gentle reminder about this PR. Please let me know if you need anything else from my side. Thank you!

@promisingcoder
Copy link
Author

@kyri-petrou could you please review my pr?

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.

Create test suite that tests the correct behaviour of ZIOApp
2 participants
0