1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Common test utilities and initialization
//!
//! This module provides shared functionality for integration tests,
//! including crypto provider initialization.
use Once;
/// Initialize cryptographic provider once for all tests
static INIT: Once = new;
/// Initialize the default crypto provider for tests.
///
/// This function ensures the crypto provider is installed exactly once,
/// even when called from multiple tests. It's safe to call this from
/// every test that needs QUIC functionality.
///
/// When both rustls-ring and rustls-aws-lc-rs features are enabled
/// (e.g., with --all-features), this prevents the panic:
/// "Could not automatically determine the process-level CryptoProvider"
///
/// # Example
/// ```
/// mod common;
///
/// #[tokio::test]
/// async fn my_test() {
/// common::init_crypto();
/// // ... test code that uses QUIC ...
/// }
/// ```