Skip to content

Commit

Permalink
Merge pull request #33 from aisuneko/main
Browse files Browse the repository at this point in the history
testing: add integration test
  • Loading branch information
aisuneko authored Oct 21, 2024
2 parents 49a5cc0 + a3d2f96 commit 9e4e1f1
Show file tree
Hide file tree
Showing 26 changed files with 219 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
*report.json
/reports.json
/summary.md
*reports.json
*summary.md
82 changes: 82 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ openssl = { version = "0.10.66", features = ["vendored"] }
toml = "0.8.19"
env_logger = "0.11.5"
log = "0.4.22"
[dev-dependencies]
assert_cmd = "2.0.16"

[profile.release]
strip = true
Expand Down
1 change: 1 addition & 0 deletions tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod tests;
5 changes: 5 additions & 0 deletions tests/test_files/distro_a/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enabled = true
testing_type = "locally"
# startup_script = "prerequisite.sh"
# stop_script = "prerequisite.sh"
skip_packages = ["docker"]
4 changes: 4 additions & 0 deletions tests/test_files/distro_a/test1/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="1.1.4"
PACKAGE_PRETTY_NAME="Test-1"
PACKAGE_TYPE="testtype1"
PACKAGE_DESCRIPTION="just a test lol"
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test1/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test1/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script but is the second one..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test1/test3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script but is the third one..."

# Do your stuff here
sleep 0

return 0
4 changes: 4 additions & 0 deletions tests/test_files/distro_a/test2/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="5.1.4"
PACKAGE_PRETTY_NAME="Test-2"
PACKAGE_TYPE="testtype2"
PACKAGE_DESCRIPTION="also trying out"
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is another example dummy test script..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test3-ill/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is yet another example dummy test script..."

# Do your stuff here
sleep 0

return 0
4 changes: 4 additions & 0 deletions tests/test_files/distro_a/test3/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="1.9.19-8"
PACKAGE_PRETTY_NAME="Test-3"
PACKAGE_TYPE="testtype3"
PACKAGE_DESCRIPTION="I failed you im sorry!!1"
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test3/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is yet another example dummy test script..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_a/test3/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is yet another example dummy test script... 2"

# Do your stuff here
sleep 0

return 0
5 changes: 5 additions & 0 deletions tests/test_files/distro_b/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enabled = true
testing_type = "locally"
# startup_script = "prerequisite.sh"
# stop_script = "prerequisite.sh"
skip_packages = ["docker"]
4 changes: 4 additions & 0 deletions tests/test_files/distro_b/test1/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="1.1.4"
PACKAGE_PRETTY_NAME="Test-1"
PACKAGE_TYPE="testtype1"
PACKAGE_DESCRIPTION="just a test lol"
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test1/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test1/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script but is the second one..."

# Do your stuff here
sleep 0

return 0
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test1/test3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is an example dummy test script but is the third one..."

# Do your stuff here
sleep 0

return 0
4 changes: 4 additions & 0 deletions tests/test_files/distro_b/test2/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="5.1.4"
PACKAGE_PRETTY_NAME="Test-2"
PACKAGE_TYPE="testtype2"
PACKAGE_DESCRIPTION="also trying out"
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is another example dummy test script..."

# Do your stuff here
sleep 0

return 0
4 changes: 4 additions & 0 deletions tests/test_files/distro_b/test4/metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACKAGE_VERSION="1.9.19-8"
PACKAGE_PRETTY_NAME="Test-3"
PACKAGE_TYPE="testtype3"
PACKAGE_DESCRIPTION="I failed you im sorry!!1"
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test4/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is yet another example dummy test script..."

# Do your stuff here
sleep 0

return 1
6 changes: 6 additions & 0 deletions tests/test_files/distro_b/test4/test2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo "This is yet another example dummy test script... 2"

# Do your stuff here
sleep 0

return 0
20 changes: 20 additions & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use assert_cmd::Command;
use std::{
env,
io::{self, Write},
};
#[test]
fn integration_test() {
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
let output = cmd
.arg("-tas")
.arg("-D")
.arg("tests/test_files")
.env("RUST_LOG", "debug")
.output()
.expect("failed to execute process");
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
// TODO: append contents of reports.json and summary.md to stdout
assert!(output.status.success());
}

0 comments on commit 9e4e1f1

Please sign in to comment.