pub struct CleanroomEnvironment { /* private fields */ }Expand description
Simple environment wrapper around existing infrastructure
Implementations§
Source§impl CleanroomEnvironment
impl CleanroomEnvironment
Sourcepub async fn execute_test<F, T>(
&self,
_test_name: &str,
test_fn: F,
) -> Result<T>
pub async fn execute_test<F, T>( &self, _test_name: &str, test_fn: F, ) -> Result<T>
Execute a test with OTel tracing
Sourcepub async fn get_metrics(&self) -> Result<SimpleMetrics>
pub async fn get_metrics(&self) -> Result<SimpleMetrics>
Get current metrics
Sourcepub async fn enable_tracing(&self) -> Result<()>
pub async fn enable_tracing(&self) -> Result<()>
Enable tracing for this environment
Sourcepub async fn enable_metrics(&self) -> Result<()>
pub async fn enable_metrics(&self) -> Result<()>
Enable metrics collection for this environment
Sourcepub async fn get_traces(&self) -> Result<Vec<String>>
pub async fn get_traces(&self) -> Result<Vec<String>>
Get traces from this environment
Sourcepub async fn get_container_reuse_stats(&self) -> (u32, u32)
pub async fn get_container_reuse_stats(&self) -> (u32, u32)
Get container reuse statistics
Sourcepub async fn has_container(&self, name: &str) -> bool
pub async fn has_container(&self, name: &str) -> bool
Check if a container with the given name has been created in this session
Sourcepub async fn register_service(
&self,
plugin: Box<dyn ServicePlugin>,
) -> Result<()>
pub async fn register_service( &self, plugin: Box<dyn ServicePlugin>, ) -> Result<()>
Register a service plugin
Sourcepub async fn start_service(&self, service_name: &str) -> Result<ServiceHandle>
pub async fn start_service(&self, service_name: &str) -> Result<ServiceHandle>
Start a service by name
Sourcepub async fn stop_service(&self, handle_id: &str) -> Result<()>
pub async fn stop_service(&self, handle_id: &str) -> Result<()>
Stop a service by handle ID
Sourcepub async fn services(&self) -> RwLockReadGuard<'_, ServiceRegistry>
pub async fn services(&self) -> RwLockReadGuard<'_, ServiceRegistry>
Get service registry (read-only access)
Sourcepub async fn register_container<T: Send + Sync + 'static>(
&self,
name: String,
container: T,
) -> Result<()>
pub async fn register_container<T: Send + Sync + 'static>( &self, name: String, container: T, ) -> Result<()>
Register a container for reuse
Sourcepub async fn get_or_create_container<F, T>(
&self,
name: &str,
factory: F,
) -> Result<T>
pub async fn get_or_create_container<F, T>( &self, name: &str, factory: F, ) -> Result<T>
Get or create container with reuse pattern
This method implements true container reuse by storing and returning the actual container instances, providing the promised 10-50x performance improvement.
Sourcepub async fn check_health(&self) -> HashMap<String, HealthStatus>
pub async fn check_health(&self) -> HashMap<String, HealthStatus>
Check health of all services
Sourcepub async fn get_service_logs(
&self,
service_id: &str,
lines: usize,
) -> Result<Vec<String>>
pub async fn get_service_logs( &self, service_id: &str, lines: usize, ) -> Result<Vec<String>>
Get service logs
Sourcepub fn session_id(&self) -> Uuid
pub fn session_id(&self) -> Uuid
Get session ID
Sourcepub async fn execute_in_container(
&self,
container_name: &str,
command: &[String],
) -> Result<ExecutionResult>
pub async fn execute_in_container( &self, container_name: &str, command: &[String], ) -> Result<ExecutionResult>
Execute a command in a container with proper error handling and observability Core Team Compliance: Async for I/O operations, proper error handling, no unwrap/expect
This method creates a fresh container for each command execution, which is appropriate for testing scenarios where isolation is more important than performance.
Trait Implementations§
Source§impl Debug for CleanroomEnvironment
impl Debug for CleanroomEnvironment
Auto Trait Implementations§
impl Freeze for CleanroomEnvironment
impl !RefUnwindSafe for CleanroomEnvironment
impl Send for CleanroomEnvironment
impl Sync for CleanroomEnvironment
impl Unpin for CleanroomEnvironment
impl !UnwindSafe for CleanroomEnvironment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request