pub(crate) mod authorizer;
pub(crate) mod connection_string;
pub(crate) mod management;
pub(crate) mod recoverable;
pub mod retry;
pub(crate) mod sas_credential;
pub(crate) mod user_agent;
pub(crate) use management::ManagementInstance;
pub(crate) use retry::recover_azure_operation;
pub(crate) const SAS_TOKEN_TYPE: &str = "servicebus.windows.net:sastoken";
#[cfg(test)]
pub(crate) mod tests {
use azure_core::{sleep::sleep, time::Duration, Result};
use tokio::select;
use tracing::info;
pub(crate) async fn force_errors<C: Clone, T: AsyncFn(C), E: Fn(C)>(
context: C,
test: T,
force_error: E,
force_error_duration: Duration,
test_duration: Duration,
) -> Result<()> {
select! {
_ = async {
test(context.clone()).await;
info!("Test completed successfully");
} => {
info!("Returning from test");
Ok::<(),azure_core::Error>(())
},
_ = async {
sleep(force_error_duration).await;
info!("Forcing error on producer");
force_error(context.clone());
sleep(test_duration).await;
} => { info!("Forcing error on producer"); Ok(()) }
_ = sleep(test_duration) => { info!("Test expired"); Ok(()) }
}
}
}