53 lines
1.9 KiB
Rust
53 lines
1.9 KiB
Rust
// file: crates/ksp-store-lib/tests/dependency_boundary.rs
|
|
// version: 1
|
|
|
|
#![warn(missing_docs)]
|
|
#![deny(unreachable_pub)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
//! Cargo-feature and dependency-boundary canaries for the common Store runtime scaffold.
|
|
|
|
#[test]
|
|
fn pre_002_manifest_owns_default_postgres_feature_and_optional_backend_edge() {
|
|
let manifest = include_str!("../Cargo.toml");
|
|
assert!(manifest.contains("default = [\"postgres\"]"));
|
|
assert!(manifest.contains("postgres = [\"dep:ksp-store-postgres-lib\"]"));
|
|
assert!(manifest.contains("ksp-store-api = { path = \"../ksp-store-api\" }"));
|
|
assert!(manifest.contains("ksp-store-postgres-lib = { path = \"../ksp-store-postgres-lib\", optional = true }"));
|
|
for forbidden in [
|
|
"ksp-config-lib",
|
|
"ksp-materializer",
|
|
"ksp-program",
|
|
"ksp-onchain-transport-lib",
|
|
"ksp-offchain-transport-lib",
|
|
"tokio-postgres",
|
|
"deadpool-postgres",
|
|
"rustls",
|
|
] {
|
|
assert!(!manifest.contains(forbidden), "forbidden pre.002 Store facade dependency detected: {forbidden}");
|
|
}
|
|
return;
|
|
}
|
|
|
|
#[test]
|
|
fn pre_002_scaffold_keeps_backend_types_and_future_runtime_surface_private() {
|
|
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 use ksp_store_postgres_lib",
|
|
"StoreSettings",
|
|
"StoreBackendSettings",
|
|
"PostgresStoreSettings",
|
|
"pub struct Store",
|
|
"tokio_postgres",
|
|
"deadpool_postgres",
|
|
] {
|
|
assert!(!crate_root.contains(forbidden), "forbidden pre.002 Store facade surface detected: {forbidden}");
|
|
}
|
|
let constants = include_str!("../src/constants.rs");
|
|
assert!(constants.contains("pub(crate) const TRACING_TARGET: &str = \"ksp-store-lib\";"));
|
|
return;
|
|
}
|