forked from eclipse-sw360/sw360
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): test health endpoint with docker
Signed-off-by: Gaurav Mishra <[email protected]>
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Copyright 2024, Siemens AG | ||
# Part of the SW360 Project. | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# SPDX-FileCopyrightText: 2024, Siemens AG | ||
# SPDX-FileContributor: Gaurav Mishra <[email protected]> | ||
# | ||
# ----------------------------------------------------------------------------- | ||
|
||
name: Docker test | ||
|
||
on: | ||
pull_request | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
docker-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout main repository | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build images | ||
run: ./docker_build.sh | ||
|
||
- name: Test cluster | ||
run: ./utils/test-cluster.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-FileCopyrightText: © 2024 Siemens AG | ||
# SPDX-FileContributor: Gaurav Mishra <[email protected]> | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
set -o errexit -o nounset -o xtrace | ||
|
||
docker compose up -d | ||
|
||
#### Sleep for Tomcat to start | ||
sleep 15 | ||
|
||
readonly HOST="127.0.0.1:8080" | ||
|
||
#### Check health endpoint | ||
curl --location "http://${HOST}/resource/api/health" | ||
curl --silent --location "http://${HOST}/resource/api/health" | grep -q '"status":"UP"' | ||
curl --silent --location "http://${HOST}/resource/api/health" | grep -q '"isDbReachable":true' | ||
curl --silent --location "http://${HOST}/resource/api/health" | grep -q '"isThriftReachable":true' | ||
|
||
docker compose down |