Skip to content

Commit

Permalink
feat(octez-client-test): remove serial
Browse files Browse the repository at this point in the history
  • Loading branch information
zcabter committed Oct 8, 2024
1 parent 63264ef commit 425f61e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 16 additions & 2 deletions crates/jstzd/tests/octez_client_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -181,6 +192,9 @@ async fn activate_protocol() {
&params_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;
Expand Down
2 changes: 0 additions & 2 deletions crates/jstzd/tests/octez_node_test.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion nix/crates.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 425f61e

Please sign in to comment.