From 425f61e487dd1b13388d999d2d178f3b19b996e4 Mon Sep 17 00:00:00 2001 From: Ryan Tan Date: Tue, 8 Oct 2024 18:23:07 +0100 Subject: [PATCH] feat(octez-client-test): remove serial --- Makefile | 3 ++- crates/jstzd/tests/octez_client_test.rs | 18 ++++++++++++++++-- crates/jstzd/tests/octez_node_test.rs | 2 -- nix/crates.nix | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cce3b472..91d8df82 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,8 @@ test-unit: test-int: # --test only runs a specified integration test (a test in /tests). # the glob pattern is used to match all integration tests - @cargo nextest run --test "*" +# but excludes wpt tests which are currently failing + @cargo nextest run --test "*" --workspace --exclude "jstz_api" .PHONY: cov cov: diff --git a/crates/jstzd/tests/octez_client_test.rs b/crates/jstzd/tests/octez_client_test.rs index 1908a394..edf31d40 100644 --- a/crates/jstzd/tests/octez_client_test.rs +++ b/crates/jstzd/tests/octez_client_test.rs @@ -7,8 +7,8 @@ use std::{ path::Path, }; use tempfile::{NamedTempFile, TempDir}; +use tokio::{fs::File, io::AsyncReadExt}; mod utils; -use serial_test::serial; use utils::retry; fn read_file(path: &Path) -> Value { @@ -145,7 +145,6 @@ async fn imports_secret_key_throws() { } #[tokio::test(flavor = "multi_thread")] -#[serial] async fn activate_protocol() { // 1. start octez node let (mut octez_node, _temp_data_dir) = spawn_octez_node().await; @@ -165,6 +164,18 @@ async fn activate_protocol() { .expect("Failed to generate activator key"); let params_file = Path::new(std::env!("CARGO_MANIFEST_DIR")).join("tests/sandbox-params.json"); + let mut file = File::open(params_file.clone()).await.unwrap(); + + // Create a buffer to hold the file contents + let mut contents = String::new(); + + // Read the file contents into the buffer + file.read_to_string(&mut contents).await.unwrap(); + + // Print the contents + println!("File contents: {}", contents); + assert!(!contents.is_empty()); + let blocks_head_endpoint = format!("http://{}/chains/main/blocks/head", "localhost:4000"); let response = get_response_text(&blocks_head_endpoint).await; @@ -181,6 +192,9 @@ async fn activate_protocol() { ¶ms_file, ) .await; + if protocol_activated.is_err() { + println!("{:?}", protocol_activated); + } assert!(protocol_activated.is_ok()); // 5. check if the protocol is activated and the block is baked. let response = get_response_text(&blocks_head_endpoint).await; diff --git a/crates/jstzd/tests/octez_node_test.rs b/crates/jstzd/tests/octez_node_test.rs index c7011c10..d5147a5a 100644 --- a/crates/jstzd/tests/octez_node_test.rs +++ b/crates/jstzd/tests/octez_node_test.rs @@ -1,10 +1,8 @@ use jstzd::task::{octez_node, Task}; -use serial_test::serial; mod utils; use utils::retry; #[tokio::test(flavor = "multi_thread")] -#[serial] async fn octez_node_test() { let data_dir = tempfile::tempdir().unwrap(); let log_file = tempfile::NamedTempFile::new().unwrap(); diff --git a/nix/crates.nix b/nix/crates.nix index e3737fdb..01efaa67 100644 --- a/nix/crates.nix +++ b/nix/crates.nix @@ -130,7 +130,7 @@ in { # Don't run the `jstz_api` integration tests until they've been paralellized # # Note: --workspace is required for --exclude. Once --exclude is removed, remove --workspace - cargoNextestExtraArgs = "--workspace --test \"*\" --exclude \"jstz_api\""; + cargoNextestExtraArgs = "--workspace --test \"*\" --exclude \"jstz_api\" --nocapture"; }); cargo-llvm-cov = craneLib.cargoLlvmCov (commonWorkspace