From 64363e7fe7d2440fc120d2e991fcd413c5ba16ed Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Sun, 9 Jun 2024 10:22:02 +0200 Subject: [PATCH] add tests CI --- .github/workflows/tests.yml | 17 +++++++++++++++++ test/run_tests.sh | 3 +-- test/tests.sh | 7 +++++-- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3d9bcd0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,17 @@ +name: "Run docker scripts tests CI" + +on: + push: + pull_request: + types: [opened, reopened] +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: "recursive" # Make sure submodules are fetched recursively + + - name: Run OntoPortal Docker tests + run: test/run_tests.sh diff --git a/test/run_tests.sh b/test/run_tests.sh index ea9cbdb..bca434b 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -1,3 +1,2 @@ #!/usr/bin/env bash -./test/bats/bin/bats ./test/tests.sh - +test/bats/bin/bats -F pretty -T --verbose-run --show-output-of-passing-tests -x --print-output-on-failure test/tests.sh diff --git a/test/tests.sh b/test/tests.sh index 0c7d0be..e6af517 100644 --- a/test/tests.sh +++ b/test/tests.sh @@ -5,10 +5,11 @@ setup() { load 'test_helper/bats-assert/load' DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" PATH="$DIR/../src:$PATH" - ./ontoportal clean -f } @test "Running and Stopping API" { + ./ontoportal clean -f + run ./ontoportal start api assert_output --partial "[+] API is up and running!" refute_output --partial 'error' @@ -20,6 +21,7 @@ setup() { } @test "Running and Stopping UI" { + ./ontoportal clean -f ./ontoportal start api @@ -29,7 +31,8 @@ setup() { refute_output --partial 'error' refute_output --partial 'ERROR' - ./ontoportal stop ui + ./ontoportal stop api + ./ontoportal stop ui run docker compose -f docker-compose_ui.yml ps assert_output "NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS"