Skip to content

Commit

Permalink
chore: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD10S committed Apr 1, 2024
1 parent dac8544 commit 3437433
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
30 changes: 9 additions & 21 deletions src/parachains/zombienet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,7 @@ mod tests {
const POLKADOT_PARACHAIN_BINARY: &str = "polkadot-parachain-v1.7.0";

#[tokio::test]
async fn test_new_success() -> Result<()> {
//cache
async fn test_new_zombienet_success() -> Result<()> {
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand Down Expand Up @@ -571,7 +570,6 @@ mod tests {

#[tokio::test]
async fn test_new_fails_wrong_config_no_para_id() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand Down Expand Up @@ -599,10 +597,9 @@ mod tests {

#[tokio::test]
async fn test_relay_chain() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());
// Parse network config

let network_config_path = PathBuf::from(CONFIG_FILE_PATH);
let config = std::fs::read_to_string(&network_config_path)?.parse::<Document>()?;

Expand All @@ -621,10 +618,9 @@ mod tests {

#[tokio::test]
async fn test_relay_chain_no_specifying_version() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());
// Parse network config

let network_config_path = PathBuf::from(CONFIG_FILE_PATH);
let config = std::fs::read_to_string(&network_config_path)?.parse::<Document>()?;

Expand All @@ -641,10 +637,9 @@ mod tests {

#[tokio::test]
async fn test_relay_chain_fails_wrong_config() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());
// Parse network config

let network_config_path = generate_wrong_config_no_relay(&temp_dir)
.expect("Error generating the testing toml file");

Expand All @@ -671,7 +666,6 @@ mod tests {

#[tokio::test]
async fn test_system_parachain() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -689,7 +683,6 @@ mod tests {

#[tokio::test]
async fn test_parachain() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -708,7 +701,6 @@ mod tests {

#[tokio::test]
async fn test_missing_binaries() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -730,7 +722,6 @@ mod tests {

#[tokio::test]
async fn test_missing_binaries_no_missing() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand Down Expand Up @@ -759,8 +750,7 @@ mod tests {
}

#[tokio::test]
async fn test_configure() -> Result<()> {
//cache
async fn test_configure_zombienet() -> Result<()> {
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -781,9 +771,8 @@ mod tests {
}

#[tokio::test]
#[ignore] // It takes long time to build
async fn test_spawn() -> Result<()> {
//cache
#[ignore = "Download and spawn networks takes too long"]
async fn test_spawn_polkadot_and_two_parachains() -> Result<()> {
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -809,7 +798,6 @@ mod tests {

#[tokio::test]
async fn test_spawn_error_no_binaries() -> Result<()> {
//cache
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());

Expand All @@ -829,7 +817,6 @@ mod tests {
Ok(())
}

// Source tests
#[tokio::test]
async fn test_process_url() -> Result<()> {
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
Expand All @@ -849,7 +836,7 @@ mod tests {
}

#[tokio::test]
#[ignore] // It takes long time to build
#[ignore = "Download all missing binaries takes too long"]
async fn test_process_git() -> Result<()> {
let temp_dir = tempfile::tempdir().expect("Could not create temp dir");
let cache = PathBuf::from(temp_dir.path());
Expand All @@ -874,6 +861,7 @@ mod tests {
temp_dir.close()?;
Ok(())
}

#[test]
fn test_versioned_name() -> Result<()> {
let versioned_name =
Expand Down
12 changes: 0 additions & 12 deletions tests/up_parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ async fn test_parachain_up() -> Result<()> {
.spawn()
.unwrap();

// Ideally should parse the output of the command

//let stdout = cmd.stdout.take().unwrap();

// thread::spawn(move || {
// let reader = BufReader::new(stdout);
// for line in reader.lines() {
// let output = line.unwrap();
// println!("All the lines: {:?}", output);
// }
// });

// If after 15 secs is still running probably execution is ok
sleep(Duration::from_secs(15)).await;
assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running");
Expand Down

0 comments on commit 3437433

Please sign in to comment.