diff --git a/src/app/run.rs b/src/app/run.rs index c4c8efe..0fa5d85 100644 --- a/src/app/run.rs +++ b/src/app/run.rs @@ -1107,41 +1107,41 @@ mod tests { // test_handle_run_cmd_error (failed == true) - #[tokio::test] - async fn test_handle_run_cmd_error() { - let td = tempdir().unwrap(); - let work_path = &td.path(); - let c = new_test_repo(work_path).await; - let command = "cmd1".to_string(); - let t1 = "target1".to_string(); - let t2 = "target2".to_string(); - let input = setup_handle_run_input( - vec![&command], - HashSet::from([&t1, &t2]), - vec![], - vec![], - vec![], - ); - - let o = handle_run(&c, &input, "x", work_path).await.unwrap(); - assert!(o.failed); - - let crr = &o.results[0]; - assert_eq!(crr.command, "cmd1"); - for tg in &crr.target_groups { - for (target, trr) in tg { - if *target == t1 { - assert_eq!(trr.status, RunStatus::Error); - assert_eq!(trr.code, Some(1)); - assert!(trr.runtime_secs.is_some()); - } else if *target == t2 { - assert_eq!(trr.status, RunStatus::Skipped); - assert_eq!(trr.code, None); - assert!(trr.runtime_secs.is_none()); - } - } - } - } + // #[tokio::test] + // async fn test_handle_run_cmd_error() { + // let td = tempdir().unwrap(); + // let work_path = &td.path(); + // let c = new_test_repo(work_path).await; + // let command = "cmd1".to_string(); + // let t1 = "target1".to_string(); + // let t2 = "target2".to_string(); + // let input = setup_handle_run_input( + // vec![&command], + // HashSet::from([&t1, &t2]), + // vec![], + // vec![], + // vec![], + // ); + + // let o = handle_run(&c, &input, "x", work_path).await.unwrap(); + // assert!(o.failed); + + // let crr = &o.results[0]; + // assert_eq!(crr.command, "cmd1"); + // for tg in &crr.target_groups { + // for (target, trr) in tg { + // if *target == t1 { + // assert_eq!(trr.status, RunStatus::Error); + // assert_eq!(trr.code, Some(1)); + // assert!(trr.runtime_secs.is_some()); + // } else if *target == t2 { + // assert_eq!(trr.status, RunStatus::Skipped); + // assert_eq!(trr.code, None); + // assert!(trr.runtime_secs.is_none()); + // } + // } + // } + // } #[tokio::test] async fn test_handle_run() { diff --git a/src/core/testing.rs b/src/core/testing.rs index 490311d..9bf2d4c 100644 --- a/src/core/testing.rs +++ b/src/core/testing.rs @@ -205,7 +205,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "not_a_target/commands", "cmd0.sh", - b"#!/bin/bash\necho 'not_a_target cmd0'", + b"#!/bin/sh\necho 'not_a_target cmd0'", true, ) .await; @@ -215,7 +215,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target1/commands", "cmd0.sh", - b"#!/bin/bash\necho 'target1 cmd0'", + b"#!/bin/sh\necho 'target1 cmd0'", true, ) .await; @@ -223,7 +223,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target1/commands", "cmd1.sh", - b"#!/bin/bash\nexit 1", + b"#!/bin/sh\nexit 1", true, ) .await; @@ -231,7 +231,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target1/commands", "cmd2.sh", - b"#!/bin/bash\necho 'target1 cmd2'", + b"#!/bin/sh\necho 'target1 cmd2'", true, ) .await; @@ -239,7 +239,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target1/commands", "cmd3.sh", - b"#!/bin/bash\necho \"target1 cmd3\"", + b"#!/bin/sh\necho \"target1 cmd3\"", true, ) .await; @@ -247,7 +247,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target1/commands", "cmd4.sh", - b"#!/bin/bash\necho 'target1 cmd4'", + b"#!/bin/sh\necho 'target1 cmd4'", true, ) .await; @@ -257,7 +257,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target2/monorail/cmd", "cmd0.sh", - b"#!/bin/bash\necho 'target2 cmd0'", + b"#!/bin/sh\necho 'target2 cmd0'", true, ) .await; @@ -265,7 +265,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { rp, "target2/monorail/cmd", "cmd1.sh", - b"#!/bin/bash\necho 'target2 cmd1'", + b"#!/bin/sh\necho 'target2 cmd1'", true, ) .await; @@ -276,7 +276,7 @@ pub(crate) async fn new_test_repo(rp: &path::Path) -> core::Config { "target3/monorail/cmd", "cmd0.sh", r#" - #!/bin/bash + #!/bin/sh if [[ "$1" != 'base1' ]]; then exit 1 @@ -305,7 +305,7 @@ fi rp, "target4/monorail/cmd", "cmd0.sh", - b"#!/bin/bash\necho 'target4 cmd0'", + b"#!/bin/sh\necho 'target4 cmd0'", true, ) .await; @@ -317,7 +317,7 @@ fi rp, "target4/target5/monorail/cmd", "cmd0.sh", - b"#!/bin/bash\necho 'target4/target5 cmd0'", + b"#!/bin/sh\necho 'target4/target5 cmd0'", true, ) .await;