From afa2a0a7fa335ae29514beb54909e81905926d1d Mon Sep 17 00:00:00 2001 From: Nasr Date: Fri, 27 Sep 2024 13:33:32 -0400 Subject: [PATCH] fix --- Cargo.lock | 1 + crates/torii/graphql/src/tests/mod.rs | 3 ++- crates/torii/grpc/Cargo.toml | 1 + .../torii/grpc/src/server/tests/entities_test.rs | 14 +++++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ed1462396..1d34aa64a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14957,6 +14957,7 @@ dependencies = [ "starknet-crypto 0.7.2", "strum 0.25.0", "strum_macros 0.25.3", + "tempfile", "thiserror", "tokio", "tokio-stream", diff --git a/crates/torii/graphql/src/tests/mod.rs b/crates/torii/graphql/src/tests/mod.rs index c7d96baff5..15c05e8bbc 100644 --- a/crates/torii/graphql/src/tests/mod.rs +++ b/crates/torii/graphql/src/tests/mod.rs @@ -279,7 +279,8 @@ pub async fn model_fixtures(db: &mut Sql) { pub async fn spinup_types_test() -> Result { let tempfile = NamedTempFile::new().unwrap(); let path = tempfile.path().to_string_lossy(); - let options = SqliteConnectOptions::from_str(&path).unwrap().create_if_missing(true).with_regexp(); + let options = + SqliteConnectOptions::from_str(&path).unwrap().create_if_missing(true).with_regexp(); let pool = SqlitePoolOptions::new() .min_connections(1) .idle_timeout(None) diff --git a/crates/torii/grpc/Cargo.toml b/crates/torii/grpc/Cargo.toml index c4eb6021e7..08cb2ae45e 100644 --- a/crates/torii/grpc/Cargo.toml +++ b/crates/torii/grpc/Cargo.toml @@ -41,6 +41,7 @@ dojo-utils.workspace = true katana-runner.workspace = true scarb.workspace = true sozo-ops.workspace = true +tempfile.workspace = true [target.'cfg(target_arch = "wasm32")'.dependencies] tonic-web-wasm-client.workspace = true diff --git a/crates/torii/grpc/src/server/tests/entities_test.rs b/crates/torii/grpc/src/server/tests/entities_test.rs index 2cf1d2624f..d8b7b759d2 100644 --- a/crates/torii/grpc/src/server/tests/entities_test.rs +++ b/crates/torii/grpc/src/server/tests/entities_test.rs @@ -18,6 +18,7 @@ use starknet::core::utils::{get_contract_address, get_selector_from_name}; use starknet::providers::jsonrpc::HttpTransport; use starknet::providers::{JsonRpcClient, Provider}; use starknet_crypto::poseidon_hash_many; +use tempfile::NamedTempFile; use tokio::sync::broadcast; use torii_core::engine::{Engine, EngineConfig, Processors}; use torii_core::executor::Executor; @@ -33,7 +34,18 @@ use crate::types::schema::Entity; #[tokio::test(flavor = "multi_thread")] #[katana_runner::test(accounts = 10, db_dir = copy_spawn_and_move_db().as_str())] async fn test_entities_queries(sequencer: &RunnerCtx) { - let pool = setup_sqlite_pool().await.unwrap(); + let tempfile = NamedTempFile::new().unwrap(); + let path = tempfile.path().to_string_lossy(); + let options = + SqliteConnectOptions::from_str(&path).unwrap().create_if_missing(true).with_regexp(); + let pool = SqlitePoolOptions::new() + .min_connections(1) + .idle_timeout(None) + .max_lifetime(None) + .connect_with(options) + .await + .unwrap(); + sqlx::migrate!("../migrations").run(&pool).await.unwrap(); let setup = CompilerTestSetup::from_examples("../../dojo-core", "../../../examples/"); let config = setup.build_test_config("spawn-and-move", Profile::DEV);