pub struct TestProcess { /* private fields */ }Expand description
Child process with isolated working directory, captured logs, and kill-on-drop cleanup.
Implementations§
Source§impl TestProcess
impl TestProcess
Sourcepub fn spawn(name: &str, command: &mut Command) -> Self
pub fn spawn(name: &str, command: &mut Command) -> Self
Spawns command in a fresh temporary directory and captures stdout/stderr to files.
Callers own product-specific arguments and environment variables. This helper owns only process lifecycle and diagnostics.
§Panics
Panics when the fixture name is invalid, its temporary directory or log files cannot be created, or the child process cannot be spawned.
Sourcepub fn runtime_dir(&self) -> &Path
pub fn runtime_dir(&self) -> &Path
Returns the isolated working directory.
Sourcepub fn terminate(&mut self)
pub fn terminate(&mut self)
Kills the child process and waits for it to exit. Repeated calls are harmless.
Sourcepub fn terminate_gracefully(&mut self, timeout: Duration) -> bool
pub fn terminate_gracefully(&mut self, timeout: Duration) -> bool
Sends SIGTERM and waits for the child to exit within timeout.
§Panics
Panics when the signal command fails, SIGTERM is rejected, or child status cannot be read.
Sourcepub fn assert_running(&mut self)
pub fn assert_running(&mut self)
Panics with captured logs when the child has exited unexpectedly.
§Panics
Panics when the fixture has stopped, child status cannot be queried, or the child exited.
Sourcepub fn diagnostics(&self) -> String
pub fn diagnostics(&self) -> String
Returns the tail of stdout and stderr for failure reporting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestProcess
impl RefUnwindSafe for TestProcess
impl Send for TestProcess
impl Sync for TestProcess
impl Unpin for TestProcess
impl UnwindSafe for TestProcess
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].