36 lines
1.7 KiB
Rust
36 lines
1.7 KiB
Rust
// file: crates/ksp-store-postgres-lib/tests/dependency_boundary.rs
|
|
// version: 1
|
|
|
|
#![warn(missing_docs)]
|
|
#![deny(unreachable_pub)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
//! Dependency-boundary canaries for the PostgreSQL Store backend scaffold.
|
|
|
|
#[test]
|
|
fn pre_002_backend_depends_on_store_api_without_reverse_facade_edge() {
|
|
let manifest = include_str!("../Cargo.toml");
|
|
assert!(manifest.contains("ksp-store-api = { path = \"../ksp-store-api\" }"));
|
|
for forbidden in ["ksp-store-lib", "ksp-config-lib", "ksp-materializer", "ksp-program", "ksp-onchain-transport-lib", "ksp-offchain-transport-lib"] {
|
|
assert!(!manifest.contains(forbidden), "forbidden PostgreSQL backend dependency detected: {forbidden}");
|
|
}
|
|
return;
|
|
}
|
|
|
|
#[test]
|
|
fn pre_002_backend_does_not_advance_connection_pool_tls_or_migrations() {
|
|
let manifest = include_str!("../Cargo.toml");
|
|
for forbidden in ["tokio", "tokio-postgres", "deadpool-postgres", "tokio-postgres-rustls", "rustls", "sha2"] {
|
|
assert!(!manifest.contains(forbidden), "premature PostgreSQL runtime dependency detected: {forbidden}");
|
|
}
|
|
let crate_root = include_str!("../src/lib.rs");
|
|
assert!(crate_root.contains("mod constants;"));
|
|
assert!(crate_root.contains("pub(crate) use self::constants::TRACING_TARGET;"));
|
|
for forbidden in ["pub mod ", "pub struct", "pub enum", "pub trait", "tokio_postgres", "deadpool_postgres", "mod migration", "SELECT ", "CREATE TABLE"] {
|
|
assert!(!crate_root.contains(forbidden), "premature PostgreSQL backend surface detected: {forbidden}");
|
|
}
|
|
let constants = include_str!("../src/constants.rs");
|
|
assert!(constants.contains("pub(crate) const TRACING_TARGET: &str = \"ksp-store-postgres-lib\";"));
|
|
return;
|
|
}
|