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

51 lines
2.0 KiB
Rust

// file: crates/ksp-store-postgres-lib/tests/public_api.rs
// version: 2
#![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::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(), 8);
return;
}