pub struct DeterminismEngine { /* private fields */ }Expand description
Determinism engine for reproducible test execution
This engine provides:
- Seeded random number generation
- Frozen clock timestamps
- Deterministic port allocation
- Hash-based volume naming
- Digest generation for trace verification
Implementations§
Source§impl DeterminismEngine
impl DeterminismEngine
Sourcepub fn new(config: DeterminismConfig) -> Result<Self>
pub fn new(config: DeterminismConfig) -> Result<Self>
Sourcepub fn get_timestamp(&self) -> DateTime<Utc>
pub fn get_timestamp(&self) -> DateTime<Utc>
Get current timestamp (frozen or actual)
If freeze_clock is configured, returns the frozen timestamp. Otherwise, returns the current system time.
Sourcepub fn get_timestamp_rfc3339(&self) -> String
pub fn get_timestamp_rfc3339(&self) -> String
Get timestamp as RFC3339 string
Sourcepub fn next_u32(&self) -> Result<u32>
pub fn next_u32(&self) -> Result<u32>
Generate next random u32 value
§Errors
- Returns error if RNG mutex is poisoned (indicates panic in another thread)
Sourcepub fn fill_bytes(&self, dest: &mut [u8]) -> Result<()>
pub fn fill_bytes(&self, dest: &mut [u8]) -> Result<()>
Fill buffer with random bytes
§Errors
- Returns error if RNG mutex is poisoned (indicates panic in another thread)
Sourcepub fn is_deterministic(&self) -> bool
pub fn is_deterministic(&self) -> bool
Check if determinism is enabled
Sourcepub fn has_frozen_clock(&self) -> bool
pub fn has_frozen_clock(&self) -> bool
Check if clock is frozen
Sourcepub fn get_frozen_clock(&self) -> Option<&str>
pub fn get_frozen_clock(&self) -> Option<&str>
Get the frozen clock timestamp string if configured
Sourcepub fn config(&self) -> &DeterminismConfig
pub fn config(&self) -> &DeterminismConfig
Get reference to configuration
Sourcepub fn allocate_port(&self) -> Result<u16>
pub fn allocate_port(&self) -> Result<u16>
Sourcepub fn release_port(&self, port: u16) -> Result<()>
pub fn release_port(&self, port: u16) -> Result<()>
Sourcepub fn allocated_ports(&self) -> Result<Vec<u16>>
pub fn allocated_ports(&self) -> Result<Vec<u16>>
Sourcepub fn generate_volume_name(&self, test_name: &str) -> String
pub fn generate_volume_name(&self, test_name: &str) -> String
Sourcepub fn generate_container_name(
&self,
test_name: &str,
step_name: &str,
) -> String
pub fn generate_container_name( &self, test_name: &str, step_name: &str, ) -> String
Sourcepub fn generate_network_name(&self, test_name: &str) -> String
pub fn generate_network_name(&self, test_name: &str) -> String
Trait Implementations§
Source§impl Clone for DeterminismEngine
impl Clone for DeterminismEngine
Auto Trait Implementations§
impl Freeze for DeterminismEngine
impl RefUnwindSafe for DeterminismEngine
impl Send for DeterminismEngine
impl Sync for DeterminismEngine
impl Unpin for DeterminismEngine
impl UnwindSafe for DeterminismEngine
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::RequestSource§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>
Wrap the input message
T in a tonic::Request