From dd870927024d71448ae981e42a3fa3b2f10ca328 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 20 Dec 2024 16:46:41 +0100 Subject: [PATCH 1/3] test: add simple test --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d6e9391 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: prepare .env + run: cp env.sample .env + - name: Build the Docker image + run: docker compose up -d + - name: Wait for HTTP 200 response + run: | + max=30 + i=0 + echo "Waiting for localhost to respond with status code 200..." + until curl --insecure --head --fail https://localhost:7007; do + i=$((i+1)) + if [ "$i" -ge "$max" ]; then + echo "Max retries reached. Exiting." + exit 1 + fi + echo "($i/$max)Waiting for https://localhost:7007 to return HTTP 200..." + sleep 5 + done + echo "RHDH is ready!" + curl --insecure https://localhost:7007 From d90d87f05bb7bdf960dc8295d255257d9ffb9c7e Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 20 Dec 2024 16:51:25 +0100 Subject: [PATCH 2/3] test: add simple test --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6e9391..882d29b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,9 +16,9 @@ jobs: - uses: actions/checkout@v4 - name: prepare .env run: cp env.sample .env - - name: Build the Docker image + - name: docker compose up run: docker compose up -d - - name: Wait for HTTP 200 response + - name: Wait for HTTP 200 response from homepage run: | max=30 i=0 @@ -27,10 +27,11 @@ jobs: i=$((i+1)) if [ "$i" -ge "$max" ]; then echo "Max retries reached. Exiting." + docker compose logs exit 1 fi echo "($i/$max)Waiting for https://localhost:7007 to return HTTP 200..." sleep 5 done echo "RHDH is ready!" - curl --insecure https://localhost:7007 + curl --insecure https://localhost:7007 \ No newline at end of file From 609c02c7a8b767f6b31a3a7e203b4b75317287c1 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 20 Dec 2024 16:58:36 +0100 Subject: [PATCH 3/3] Signed-off-by: Tomas Kral --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 882d29b..9272cfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,15 +23,15 @@ jobs: max=30 i=0 echo "Waiting for localhost to respond with status code 200..." - until curl --insecure --head --fail https://localhost:7007; do + until curl --head --fail http://localhost:7007; do i=$((i+1)) if [ "$i" -ge "$max" ]; then echo "Max retries reached. Exiting." docker compose logs exit 1 fi - echo "($i/$max)Waiting for https://localhost:7007 to return HTTP 200..." + echo "($i/$max)Waiting for http://localhost:7007 to return HTTP 200..." sleep 5 done echo "RHDH is ready!" - curl --insecure https://localhost:7007 \ No newline at end of file + curl --insecure http://localhost:7007 \ No newline at end of file