From 4663b5e8c754193909308a892dcb9454ea9b5f99 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez <11448715+al3mart@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:47:31 +0100 Subject: [PATCH] [CI test] test: include instantiate_call_data_works (#389) * test: include instantiate_call_data_works * test: increase sleep time in run_contracts_node * fix: fmt --------- Co-authored-by: AlexD10S --- crates/pop-cli/src/commands/up/contract.rs | 11 ++++++----- crates/pop-contracts/src/node/mod.rs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/pop-cli/src/commands/up/contract.rs b/crates/pop-cli/src/commands/up/contract.rs index 497a01c0..df1edaf6 100644 --- a/crates/pop-cli/src/commands/up/contract.rs +++ b/crates/pop-cli/src/commands/up/contract.rs @@ -483,18 +483,19 @@ mod tests { let localhost_url = format!("ws://127.0.0.1:{}", port); sleep(Duration::from_secs(5)).await; - get_upload_call_data_works(port, temp_dir).await?; + get_upload_call_data_works(port, temp_dir.path().join("testing")).await?; + get_instantiate_call_data_works(port, temp_dir.path().join("testing")).await?; // Stop running contracts-node stop_test_environment(&contracts_node_process.id().to_string())?; Ok(()) } - async fn get_upload_call_data_works(port: u16, temp_dir: TempDir) -> anyhow::Result<()> { + async fn get_upload_call_data_works(port: u16, temp_dir: PathBuf) -> anyhow::Result<()> { let localhost_url = format!("ws://127.0.0.1:{}", port); let up_contract_opts = UpContractCommand { - path: Some(temp_dir.path().join("testing")), + path: Some(temp_dir), constructor: "new".to_string(), args: vec![], value: "0".to_string(), @@ -541,11 +542,11 @@ mod tests { Ok(()) } - async fn get_instantiate_call_data_works(port: u16, temp_dir: TempDir) -> anyhow::Result<()> { + async fn get_instantiate_call_data_works(port: u16, temp_dir: PathBuf) -> anyhow::Result<()> { let localhost_url = format!("ws://127.0.0.1:{}", port); let up_contract_opts = UpContractCommand { - path: Some(temp_dir.path().join("testing")), + path: Some(temp_dir), constructor: "new".to_string(), args: vec!["false".to_string()], value: "0".to_string(), diff --git a/crates/pop-contracts/src/node/mod.rs b/crates/pop-contracts/src/node/mod.rs index 425a2d05..060dca16 100644 --- a/crates/pop-contracts/src/node/mod.rs +++ b/crates/pop-contracts/src/node/mod.rs @@ -132,8 +132,8 @@ pub async fn run_contracts_node( let process = command.spawn()?; - // Wait 5 secs until the node is ready - sleep(Duration::from_millis(5000)).await; + // Wait 20 secs until the node is ready + sleep(Duration::from_millis(20000)).await; let data = Value::from_bytes(subxt::utils::to_hex("initialize contracts node")); let payload = subxt::dynamic::tx("System", "remark", [data].to_vec());