Skip to content

Commit

Permalink
[CI test] test: include instantiate_call_data_works (#389)
Browse files Browse the repository at this point in the history
* test: include instantiate_call_data_works

* test: increase sleep time in run_contracts_node

* fix: fmt

---------

Co-authored-by: AlexD10S <[email protected]>
  • Loading branch information
al3mart and AlexD10S authored Dec 18, 2024
1 parent 5e12dea commit 4663b5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions crates/pop-cli/src/commands/up/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions crates/pop-contracts/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4663b5e

Please sign in to comment.