From 40e0d33a922dc0a6b27cbbc8cad3e3d0c7a864e1 Mon Sep 17 00:00:00 2001 From: Moti Asayag Date: Sun, 29 Oct 2023 20:09:59 +0200 Subject: [PATCH] Update integration test --- .github/workflows/on_push.yml | 17 +++++++++++++++-- .github/workflows/test.sh | 11 +++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 .github/workflows/test.sh diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 815d462..678ab8b 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -16,5 +16,18 @@ jobs: with: compose-file: "docker-compose.yml" down-flags: "--volumes --remove-orphans --rmi local" - test-container: "blood-info" - test-command: "$(wget -q -O- --no-check-certificate https://localhost:8443/station | jq '. | length') -gt 0" + + - name: Run Tests + shell: bash + run: | + chmod +x ./github/workflows/test.sh # Make the script executable + ./github/workflows/test.sh # Run the test script + + - name: Display Test Results + shell: bash + run: | + if [ $? -eq 0 ]; then + echo "Tests passed" + else + echo "Tests failed" + fi diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh new file mode 100755 index 0000000..b560be2 --- /dev/null +++ b/.github/workflows/test.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +result=$(wget -q -O- --no-check-certificate https://localhost:8443/stations | jq '. | length') + +if [ -n "$result" ] && [ "$result" -ne 0 ]; then + echo "Test passed: Result is not empty and not zero." + exit 0 # Test passed +else + echo "Test failed: Result is empty or zero." + exit 1 # Test failed +fi