Files
reth/crates/node-ethereum/tests/it/builder.rs
Matthias Seitz cfc914669b feat: declarative builder v2 (#6447)
Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
2024-02-13 22:51:38 +00:00

35 lines
1.0 KiB
Rust

//! Node builder setup tests.
use reth_db::test_utils::create_test_rw_db;
use reth_node_builder::{components::FullNodeComponents, NodeBuilder, NodeConfig};
use reth_node_ethereum::node::EthereumNode;
#[test]
fn test_basic_setup() {
// parse CLI -> config
let config = NodeConfig::test();
let db = create_test_rw_db();
let msg = "On components".to_string();
let _builder = NodeBuilder::new(config)
.with_database(db)
.with_types(EthereumNode::default())
.with_components(EthereumNode::components())
.on_component_initialized(move |ctx| {
let _provider = ctx.provider();
println!("{msg}");
Ok(())
})
.on_node_started(|_full_node| Ok(()))
.on_rpc_started(|_ctx, handles| {
let _client = handles.rpc.http_client();
Ok(())
})
.extend_rpc_modules(|ctx| {
let _ = ctx.config();
let _ = ctx.node().provider();
Ok(())
})
.check_launch();
}