diff --git a/Cargo.lock b/Cargo.lock index 14fc0ae7..c2bbce09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3501,6 +3501,18 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +[[package]] +name = "e2e-tests" +version = "0.1.0" +dependencies = [ + "reqwest 0.11.27", + "serde_json", + "tokio", + "tokio-stream", + "tokio-util", + "url", +] + [[package]] name = "ecdsa" version = "0.16.9" diff --git a/Cargo.toml b/Cargo.toml index ece67680..2529e27d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "crates/prover_services/sharp_service", "crates/utils", "crates/settlement_clients/settlement-client-interface", + "e2e-tests", ] [workspace.package] @@ -37,6 +38,8 @@ starknet = "0.9.0" tempfile = "3.8.1" thiserror = "1.0.57" tokio = { version = "1.37.0" } +tokio-stream = "0.1.15" +tokio-util = "0.7.11" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18" } url = { version = "2.5.0", features = ["serde"] } diff --git a/crates/orchestrator/src/tests/jobs/da_job/mod.rs b/crates/orchestrator/src/tests/jobs/da_job/mod.rs index 35887820..366d5369 100644 --- a/crates/orchestrator/src/tests/jobs/da_job/mod.rs +++ b/crates/orchestrator/src/tests/jobs/da_job/mod.rs @@ -48,7 +48,8 @@ async fn test_process_job() { let mut da_client = MockDaClient::new(); let internal_id = "1"; da_client.expect_publish_state_diff().times(1).returning(|_| Ok(internal_id.to_string())); - let config = init_config(Some(format!("http://localhost:{}", server.port())), None, None, Some(da_client), None).await; + let config = + init_config(Some(format!("http://localhost:{}", server.port())), None, None, Some(da_client), None).await; let state_update = MaybePendingStateUpdate::Update(StateUpdate { block_hash: FieldElement::default(), diff --git a/e2e-tests/Cargo.toml b/e2e-tests/Cargo.toml index 7d56d999..a79acfc0 100644 --- a/e2e-tests/Cargo.toml +++ b/e2e-tests/Cargo.toml @@ -4,11 +4,11 @@ version = "0.1.0" edition = "2021" [dependencies] -tokio.workspace = true +tokio= { workspace = true, features = ["full"] } tokio-util.workspace = true tokio-stream.workspace = true url.workspace = true -reqwest.workspace = true +reqwest = { workspace = true, features = ["json"] } serde_json.workspace = true [[test]] diff --git a/e2e-tests/src/lib.rs b/e2e-tests/src/lib.rs index 12987b17..86e832a8 100644 --- a/e2e-tests/src/lib.rs +++ b/e2e-tests/src/lib.rs @@ -72,7 +72,18 @@ impl Orchestrator { let args = [args, vec!["--rpc-address", address.as_str()]].concat(); let port_str = format!("{}", port); - let process = Self::cargo_run(repository_root.as_path(), binary, args, vec![("PORT", port_str.as_str())]); + let process = Self::cargo_run( + repository_root.as_path(), + binary, + args, + vec![ + ("PORT", port_str.as_str()), + // TODO: mock Madara RPC API + ("MADARA_RPC_URL", "http://localhost"), + // TODO: spawn mongo db + ("MONGODB_CONNECTION_STRING", "http://localhost"), + ], + ); Self { process, address } } diff --git a/e2e-tests/test_prover_jobs.rs b/e2e-tests/test_prover_jobs.rs index 28cef186..dbf00133 100644 --- a/e2e-tests/test_prover_jobs.rs +++ b/e2e-tests/test_prover_jobs.rs @@ -10,11 +10,7 @@ async fn test_sharp_job_completes() { let client = reqwest::Client::new(); - let create_job = json!({ "job_type": "ProofRegistration", "internal_id": "12345" }); + let create_job = json!({ "job_type": "ProofCreation", "internal_id": "12345" }); - client.get(orchestrator.endpoint().join("/create_job").unwrap()) - .json(&create_job) - .send() - .await - .unwrap(); + client.get(orchestrator.endpoint().join("/create_job").unwrap()).json(&create_job).send().await.unwrap(); }