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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Rustdoc-only wrappers for rstest fixtures.
//!
//! These functions mirror the runtime fixtures but remain separate so the
//! `#[fixture]` macro (which expands into additional attributes) is never
//! applied to items with doc comments. This keeps Whitaker's
//! `function_attrs_follow_docs` lint happy while preserving documentation.
use crate::;
/// `rstest` fixture that yields a running [`TestCluster`].
///
/// The fixture blocks until `PostgreSQL` is ready, making it ideal for
/// integration tests that only need to declare a `cluster: TestCluster`
/// parameter without invoking [`TestCluster::new`] manually.
///
/// # Examples
/// ```no_run
/// use pg_embedded_setup_unpriv::{TestCluster, test_support::test_cluster};
/// use rstest::rstest;
///
/// #[rstest]
/// fn exercises_database(test_cluster: TestCluster) {
/// let metadata = test_cluster.connection().metadata();
/// assert!(metadata.port() > 0);
/// }
/// ```
/// `rstest` fixture that yields a reference to the shared [`TestCluster`].
///
/// This fixture provides access to a process-global cluster that is
/// initialized once and reused across all tests in the same binary. Use this
/// when tests can share a cluster and create per-test databases for isolation.
///
/// # Panics
///
/// Panics with a `SKIP-TEST-CLUSTER:`-prefixed message if the shared cluster
/// cannot be started. This allows test harnesses to detect and skip tests when
/// `PostgreSQL` is unavailable.
///
/// # Examples
///
/// ```no_run
/// use pg_embedded_setup_unpriv::{TestCluster, test_support::shared_test_cluster};
/// use rstest::rstest;
///
/// #[rstest]
/// fn uses_shared_cluster(shared_test_cluster: &'static TestCluster) {
/// let metadata = shared_test_cluster.connection().metadata();
/// assert!(metadata.port() > 0);
/// }
/// ```
/// `rstest` fixture that yields a reference to the shared [`ClusterHandle`].
///
/// This fixture provides access to a process-global handle that is
/// initialized once and reused across all tests in the same binary. The handle
/// is `Send + Sync`, making it suitable for rstest timeouts and other
/// thread-safe contexts.
///
/// # Panics
///
/// Panics with a `SKIP-TEST-CLUSTER:`-prefixed message if the shared cluster
/// cannot be started. This allows test harnesses to detect and skip tests when
/// `PostgreSQL` is unavailable.
///
/// # Examples
///
/// ```no_run
/// use pg_embedded_setup_unpriv::{ClusterHandle, test_support::shared_test_cluster_handle};
/// use rstest::rstest;
///
/// #[rstest]
/// fn uses_shared_handle(shared_test_cluster_handle: &'static ClusterHandle) {
/// assert!(
/// shared_test_cluster_handle
/// .database_exists("postgres")
/// .expect("expected 'postgres' database to exist in shared_test_cluster_handle")
/// );
/// }
/// ```