45 lines
1.7 KiB
Rust
45 lines
1.7 KiB
Rust
// file: crates/ksp-store-postgres-lib/tests/public_api.rs
|
|
// version: 1
|
|
|
|
#![warn(missing_docs)]
|
|
#![deny(unreachable_pub)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
//! Narrow physical bridge canaries consumed by `ksp-store-lib` without exposing driver or pool types.
|
|
|
|
#[test]
|
|
fn pre_005_backend_bridge_is_constructible_without_io() {
|
|
let network = match ksp_store_api::RawNetworkId::new("devnet") {
|
|
std::result::Result::Ok(value) => value,
|
|
std::result::Result::Err(error) => panic!("valid backend bridge network rejected: {error:?}"),
|
|
};
|
|
let settings = ksp_store_postgres_lib::PostgresBackendSettings::new(
|
|
network,
|
|
"postgresql://operator:secret@localhost/ksp",
|
|
8,
|
|
std::time::Duration::from_secs(10),
|
|
std::time::Duration::from_secs(5),
|
|
std::time::Duration::from_secs(10),
|
|
std::time::Duration::from_secs(5),
|
|
ksp_store_postgres_lib::PostgresBackendTlsMode::VerifyFull,
|
|
);
|
|
assert_eq!(settings.network().as_str(), "devnet");
|
|
assert_eq!(settings.tls_mode().code(), "verify_full");
|
|
let _open = ksp_store_postgres_lib::PostgresBackend::open;
|
|
let _close = ksp_store_postgres_lib::PostgresBackend::close;
|
|
return;
|
|
}
|
|
|
|
#[test]
|
|
fn pre_005_backend_error_projection_is_safe_and_static() {
|
|
let kinds = [
|
|
ksp_store_postgres_lib::PostgresBackendErrorKind::ConfigInvalid,
|
|
ksp_store_postgres_lib::PostgresBackendErrorKind::ConnectFailed,
|
|
ksp_store_postgres_lib::PostgresBackendErrorKind::PoolTimeout,
|
|
ksp_store_postgres_lib::PostgresBackendErrorKind::ShutdownTimeout,
|
|
ksp_store_postgres_lib::PostgresBackendErrorKind::TlsFailed,
|
|
];
|
|
assert_eq!(kinds.len(), 5);
|
|
return;
|
|
}
|