77 lines
2.5 KiB
Rust
77 lines
2.5 KiB
Rust
// file: crates/ksp-app-raw-transaction-ingest-desk/tests/dependency_boundary.rs
|
|
// version: 3
|
|
|
|
//! Dependency-boundary canaries for Raw Transaction Ingest Desk Start-resource reconstruction.
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![deny(unreachable_pub)]
|
|
#![warn(missing_docs)]
|
|
|
|
fn app_root() -> std::path::PathBuf {
|
|
return std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
}
|
|
|
|
fn read_text(path: &std::path::Path) -> String {
|
|
let source = std::fs::read_to_string(path);
|
|
assert!(source.is_ok(), "unable to read {}", path.display());
|
|
return match source {
|
|
std::result::Result::Ok(value) => value,
|
|
std::result::Result::Err(_) => String::new(),
|
|
};
|
|
}
|
|
|
|
#[test]
|
|
fn pre_007_manifest_adds_only_worker_vertical_to_existing_config_transport_boundary() {
|
|
let manifest = read_text(app_root().join("Cargo.toml").as_path());
|
|
for required in [
|
|
"ksp-config-lib",
|
|
"ksp-core-lib",
|
|
"ksp-logging-lib",
|
|
"ksp-onchain-transport-lib",
|
|
"ksp-worker-raw-transaction-ingest-lib",
|
|
"tauri-plugin-tracing",
|
|
] {
|
|
assert!(manifest.contains(required), "missing pre.007 dependency {required}");
|
|
}
|
|
for forbidden in [
|
|
"ksp-store-lib",
|
|
"ksp-store-api",
|
|
"ksp-store-postgres-lib",
|
|
"ksp-worker-api",
|
|
"ksp-job-backfill-lib",
|
|
"reqwest",
|
|
"tokio-postgres",
|
|
"tonic",
|
|
"yellowstone-grpc",
|
|
] {
|
|
assert!(!manifest.contains(forbidden), "pre.007 opens forbidden direct dependency {forbidden}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn pre_007_route_start_reconstructs_exact_worker_sources_without_network_store_or_worker_launch() {
|
|
let source = read_text(app_root().join("src/route_start.rs").as_path());
|
|
for required in [
|
|
"HttpTransportPool::new",
|
|
"YellowstoneGrpcChannel::prepare",
|
|
"RawTransactionIngestYellowstoneSource::new",
|
|
"RawTransactionIngestStandardLogsSource::new",
|
|
"RawTransactionIngestStandardBlockSource::new",
|
|
"RawTransactionIngestHeliusTransactionSource::new",
|
|
"RawTransactionIngestHttpBlockPollingSource::new",
|
|
] {
|
|
assert!(source.contains(required), "missing exact resource constructor {required}");
|
|
}
|
|
for forbidden in [
|
|
"YellowstoneGrpcChannel::connect",
|
|
"SolanaStandardWsSession::connect",
|
|
"HeliusWsSession::connect",
|
|
"Store::open",
|
|
"RawTransactionIngestWorker::",
|
|
"start_with_runtime_resources",
|
|
"request_stop",
|
|
] {
|
|
assert!(!source.contains(forbidden), "pre.007 performs premature runtime operation {forbidden}");
|
|
}
|
|
}
|