Skip to content

Commit

Permalink
Simplify test code with setup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Feb 6, 2025
1 parent d90f003 commit 807ce9c
Showing 1 changed file with 2 additions and 44 deletions.
46 changes: 2 additions & 44 deletions domains/client/domain-operator/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,28 +1778,7 @@ async fn test_executor_inherent_timestamp_is_set() {

#[tokio::test(flavor = "multi_thread")]
async fn test_bad_invalid_bundle_fraud_proof_is_rejected() {
let directory = TempDir::new().expect("Must be able to create temporary directory");

let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(false);
let _ = builder.init();

let tokio_handle = tokio::runtime::Handle::current();

// Start Ferdie
let mut ferdie = MockConsensusNode::run(
tokio_handle.clone(),
Ferdie,
BasePath::new(directory.path().join("ferdie")),
);

// Run Alice (a evm domain authority node)
let mut alice = domain_test_service::DomainNodeBuilder::new(
tokio_handle.clone(),
BasePath::new(directory.path().join("alice")),
)
.build_evm_node(Role::Authority, Alice, &mut ferdie)
.await;
let (_directory, mut ferdie, mut alice) = setup_evm_test_nodes(Ferdie).await;

let fraud_proof_generator = FraudProofGenerator::new(
alice.client.clone(),
Expand Down Expand Up @@ -2023,28 +2002,7 @@ async fn test_bad_invalid_bundle_fraud_proof_is_rejected() {

#[tokio::test(flavor = "multi_thread")]
async fn test_bad_fraud_proof_is_rejected() {
let directory = TempDir::new().expect("Must be able to create temporary directory");

let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(false);
let _ = builder.init();

let tokio_handle = tokio::runtime::Handle::current();

// Start Ferdie
let mut ferdie = MockConsensusNode::run(
tokio_handle.clone(),
Ferdie,
BasePath::new(directory.path().join("ferdie")),
);

// Run Alice (a evm domain authority node)
let mut alice = domain_test_service::DomainNodeBuilder::new(
tokio_handle.clone(),
BasePath::new(directory.path().join("alice")),
)
.build_evm_node(Role::Authority, Alice, &mut ferdie)
.await;
let (_directory, mut ferdie, mut alice) = setup_evm_test_nodes(Ferdie).await;

let fraud_proof_generator = FraudProofGenerator::new(
alice.client.clone(),
Expand Down

0 comments on commit 807ce9c

Please sign in to comment.