Skip to content

Commit

Permalink
Export setup module under test-utils feature (#2247)
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy authored Aug 1, 2024
1 parent 566ad6c commit 9d694e8
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 12 deletions.
8 changes: 7 additions & 1 deletion crates/katana/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ pub async fn start(
let block_producer = Arc::new(block_producer);

// TODO: avoid dangling task, or at least store the handle to the NodeService
tokio::spawn(NodeService::new(Arc::clone(&pool), miner, block_producer.clone(), messaging));
tokio::spawn(NodeService::new(
Arc::clone(&pool),
miner,
block_producer.clone(),
#[cfg(feature = "messaging")]
messaging,
));

// --- spawn rpc server

Expand Down
6 changes: 6 additions & 0 deletions crates/sozo/ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ toml.workspace = true
tracing.workspace = true
url.workspace = true

dojo-test-utils = { workspace = true, features = [ "build-examples" ], optional = true }
katana-runner = { workspace = true, optional = true }

[dev-dependencies]
assert_fs.workspace = true
dojo-test-utils = { workspace = true, features = [ "build-examples" ] }
ipfs-api-backend-hyper = { git = "https://github.com/ferristseng/rust-ipfs-api", rev = "af2c17f7b19ef5b9898f458d97a90055c3605633", features = [ "with-hyper-rustls" ] }
katana-runner.workspace = true
tee = "0.1.0"

[features]
test-utils = [ "dep:dojo-test-utils", "dep:katana-runner" ]
3 changes: 3 additions & 0 deletions crates/sozo/ops/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ pub mod register;
pub mod statistics;
pub mod utils;

#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

#[cfg(test)]
pub mod tests;
1 change: 1 addition & 0 deletions crates/sozo/ops/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod setup;
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/tests/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use scarb_ui::{OutputFormat, Ui, Verbosity};
use starknet::accounts::{Account, ConnectedAccount};
use starknet::core::types::{BlockId, BlockTag};

use super::setup;
use crate::auth::{self, ResourceOwner, ResourceType, ResourceWriter};
use crate::execute;
use crate::test_utils::setup;

const ACTION_CONTRACT_NAME: &str = "dojo_examples-actions";
const DEFAULT_NAMESPACE: &str = "dojo_examples";
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/tests/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::JsonRpcClient;
use starknet::signers::LocalWallet;

use super::setup;
use crate::test_utils::setup;
use crate::{call, utils};

const CONTRACT_TAG: &str = "dojo_examples-actions";
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/tests/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use starknet::macros::felt;
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::JsonRpcClient;

use super::setup;
use crate::migration::{
auto_authorize, execute_strategy, find_authorization_diff, upload_metadata,
};
use crate::test_utils::setup;
use crate::utils::get_contract_address_from_reader;

#[tokio::test(flavor = "multi_thread")]
Expand Down
11 changes: 5 additions & 6 deletions crates/sozo/ops/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod auth;
pub mod call;
pub mod migration;
pub mod model;
pub mod setup;
pub mod utils;
mod auth;
mod call;
mod migration;
mod model;
mod utils;
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/tests/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use scarb_ui::{OutputFormat, Ui, Verbosity};
use starknet::accounts::Account;
use starknet::core::types::Felt;

use super::setup;
use crate::test_utils::setup;
use crate::{execute, model};

// Test model ops in the same to avoid spinning up several katana with full
Expand Down
2 changes: 1 addition & 1 deletion crates/sozo/ops/src/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use katana_runner::KatanaRunner;
use starknet::accounts::ConnectedAccount;
use starknet::core::types::{BlockId, BlockTag, Felt};

use super::setup;
use crate::test_utils::setup;
use crate::utils;

const ACTION_CONTRACT_TAG: &str = "dojo_examples-actions";
Expand Down

0 comments on commit 9d694e8

Please sign in to comment.