From b7c477d4a3356ff69adce8a8a98e2499f67e0261 Mon Sep 17 00:00:00 2001 From: James Tufarelli Date: Mon, 23 Oct 2023 17:29:05 -0700 Subject: [PATCH] Adding more integration tests --- pkg/test.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/pkg/test.sh b/pkg/test.sh index 7648d91b..87cc432a 100755 --- a/pkg/test.sh +++ b/pkg/test.sh @@ -16,7 +16,6 @@ test_cron() { echo "Test Passed: Output matches expected output." echo "Expected: $EXPECTED_OUTPUT" echo "Got: $ACTUAL_OUTPUT" - exit 0 else echo "Test Failed: Output does not match expected output." echo "Expected: $EXPECTED_OUTPUT" @@ -25,6 +24,57 @@ test_cron() { fi } -test_cron + +test_bash( + EXPECTED_OUTPUT="/bin/bash" + ACTUAL_OUTPUT=$(which bash) + + # Compare the actual output to the expected output + if [ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]; then + echo "Test Passed: Output matches expected output." + echo "Expected: $EXPECTED_OUTPUT" + echo "Got: $ACTUAL_OUTPUT" + else + echo "Test Failed: Output does not match expected output." + echo "Expected: $EXPECTED_OUTPUT" + echo "Got: $ACTUAL_OUTPUT" + exit 1 + fi +) + +test_rsync( + EXPECTED_OUTPUT="/usr/bin/rsync" + ACTUAL_OUTPUT=$(which rsync) + + # Compare the actual output to the expected output + if [ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]; then + echo "Test Passed: Rsync is installed" + else + echo "Test Failed: Output does not match expected output." + echo "Expected: $EXPECTED_OUTPUT" + echo "Got: $ACTUAL_OUTPUT" + exit 1 + fi +) + +test_jq( + EXPECTED_OUTPUT="/usr/bin/jq" + ACTUAL_OUTPUT=$(which jq) + + # Compare the actual output to the expected output + if [ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]; then + echo "Test Passed: QJ is installed" + else + echo "Test Failed: Output does not match expected output." + echo "Expected: $EXPECTED_OUTPUT" + echo "Got: $ACTUAL_OUTPUT" + exit 1 + fi +) + +test_cron +test_bash +test_rsync +test_jq echo "All tests passed!" \ No newline at end of file