Files
khadhroony-solana-project/crates/ksp-store-postgres-lib/tests/public_api.rs
2026-08-29 21:40:57 +02:00

61 lines
2.5 KiB
Rust

// file: crates/ksp-store-postgres-lib/tests/public_api.rs
// version: 3
#![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,
true,
std::time::Duration::from_secs(30),
std::time::Duration::from_secs(10),
);
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::HealthFailed,
ksp_store_postgres_lib::PostgresBackendErrorKind::MigrationFailed,
ksp_store_postgres_lib::PostgresBackendErrorKind::MigrationMismatch,
ksp_store_postgres_lib::PostgresBackendErrorKind::SchemaNewer,
ksp_store_postgres_lib::PostgresBackendErrorKind::ShutdownTimeout,
ksp_store_postgres_lib::PostgresBackendErrorKind::TlsFailed,
];
assert_eq!(kinds.len(), 9);
return;
}
#[test]
fn pre_007_backend_health_bridge_exposes_only_safe_snapshot_types() {
let _runtime = std::mem::size_of::<std::option::Option<ksp_store_postgres_lib::PostgresBackendRuntimeSnapshot>>();
let _health = std::mem::size_of::<std::option::Option<ksp_store_postgres_lib::PostgresBackendHealthSnapshot>>();
let _runtime_snapshot = ksp_store_postgres_lib::PostgresBackend::runtime_snapshot;
let _health_probe = ksp_store_postgres_lib::PostgresBackend::health;
return;
}