Service Utils 🛠️
A Rust utility crate for testing service binaries with ease.
Features ✨
- Wait Strategies: Flexible waiting mechanisms to ensure services are ready
- Debug Mode: Enhanced logging and debugging capabilities
- Environment Control: Configure service environment variables
- Error Handling: Comprehensive error handling for service operations
Usage 🚀
Add this to your Cargo.toml
:
[]
= "0.1.0"
Basic Example
use ;
async
With Configuration
use ;
async
Wait Strategies 🕒
The crate provides several wait strategies through the wait_utils
dependency:
WaitForSeconds(u64)
: Wait for a specified number of secondsWaitUntilConsoleOutputContains(String, u64)
: Wait until specific output appearsWaitUntilPortIsAvailable(u16, u64)
: Wait for a port to become available- Custom strategies can be implemented as needed
Error Handling 🚨
The crate uses a dedicated ServiceUtilError
type that covers various failure scenarios:
- Binary not found
- Service start failure
- Wait strategy timeout
- Environment configuration errors
Debug Mode 🔍
Enable debug mode for additional logging and information:
let service_util = with_debug.await?;
Contributing 🤝
Contributions are welcome! Please feel free to submit a Pull Request.
License 📄
This project is licensed under the terms specified in the workspace configuration.
Related Crates 📦
wait_utils
: Provides wait strategies used by this cratedocker_utils
: Docker container management utilities