Skip to content

Commit

Permalink
Merge pull request #33 from ba-st/integration_tests_gs64
Browse files Browse the repository at this point in the history
Add integration tests for GS64
  • Loading branch information
gcotelli authored Mar 4, 2024
2 parents dd4bf64 + 601cb02 commit 5f8d289
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: ./
file: ./docker/Dockerfile
file: ./docker/pharo/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/integration-tests-gs64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Integration Tests GS64
on:
- push
- pull_request
- workflow_dispatch
jobs:
integration-tests:
runs-on: ubuntu-latest
name: Integration Tests GS64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Configure keyfile
run: |
echo "$GS_KEYFILE" > ./api-tests/gs64/gemstone.key
env:
GS_KEYFILE: ${{ secrets.GS_KEYFILE }}
- name: Run GS64 tests using Docker
run: ./compose-test-gs64.sh
- name: Remove keyfile
if: always()
run: rm -f ./api-tests/gs64/gemstone.key
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Run tests using Docker
run: ./compose-test.sh
- name: Run Pharo tests using Docker
run: ./compose-test-pharo.sh
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ plugin to interact with the [Consul](https://www.consul.io) HTTP API.

[![Baseline Groups](https://github.com/ba-st/Stargate-Consul/actions/workflows/loading-groups.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/loading-groups.yml)
[![GS64 Components](https://github.com/ba-st/Stargate-Consul/actions/workflows/loading-gs64-components.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/loading-gs64-components.yml)
[![Integration Tests](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests.yml)
[![Pharo - Integration Tests](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests.yml)
[![GS64 - Integration Tests](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests-gs64.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/integration-tests-gs64.yml)

[![Markdown Lint](https://github.com/ba-st/Stargate-Consul/actions/workflows/markdown-lint.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/markdown-lint.yml)
[![Shellcheck](https://github.com/ba-st/Stargate-Consul/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/ba-st/Stargate-Consul/actions/workflows/shellcheck.yml)

Expand Down
1 change: 1 addition & 0 deletions api-tests/gs64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gemstone.key
42 changes: 42 additions & 0 deletions api-tests/gs64/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3'
services:
api:
build:
context: ../../
dockerfile: docker/gs64/Dockerfile
cap_add:
- CAP_SYS_RESOURCE
ports:
- "8080:8080"
environment:
STARGATE__PUBLIC_URL: http://api:8080
STARGATE__PORT: 8080
STARGATE__OPERATIONS_SECRET: API-tests
HEALTH_CHECK_TOKEN: eyJhbGciOiJIUzI1NiJ9.eyJwZXJtaXNzaW9ucyI6WyJleGVjdXRlOmhlYWx0aC1jaGVjayJdfQ.gLammIebJuNDYDz70T8ZYK9GV8jXWrt18mPnLPvoCjw
STARGATE__CONSUL_AGENT_LOCATION: http://consul-agent:8500
GS64_STONE_HOSTNAME: stone
TZ: America/Argentina/Buenos_Aires
volumes:
- ./gem.conf:/opt/gemstone/conf.gem.conf
depends_on:
- consul-agent
- stone
stone:
init: true
image: ghcr.io/ba-st/gs64-rowan:v3.7.0
cap_add:
- CAP_SYS_RESOURCE
environment:
TZ: America/Argentina/Buenos_Aires
volumes:
- ./gem.conf:/opt/gemstone/conf/gem.conf
- ./gemstone.key:/opt/gemstone/product/sys/gemstone.key:ro
- $PWD:/opt/gemstone/projects/Stargate-Consul
consul-agent:
image: consul:1.8
ports:
- "8500:8500"
- "8600:8600"
- "8300:8300"
environment:
CONSUL_BIND_INTERFACE: eth0
1 change: 1 addition & 0 deletions api-tests/gs64/gem.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEM_TEMPOBJ_CACHE_SIZE = 500000KB;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: '3'
services:
api:
build:
context: ../
dockerfile: docker/Dockerfile
context: ../../
dockerfile: docker/pharo/Dockerfile
ports:
- "8080:8080"
environment:
Expand Down
28 changes: 28 additions & 0 deletions compose-test-gs64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -e

echo "Building API"
docker compose -f api-tests/gs64/docker-compose.yml build api
echo "Starting Stone"
docker compose -f api-tests/gs64/docker-compose.yml up -d stone
echo "Starting Consul Agent"
docker compose -f api-tests/gs64/docker-compose.yml up -d consul-agent
sleep 2
echo "Installing support code"
docker exec -i -u gemstone gs64-stone-1 ./load-rowan-project.sh Stargate-Consul Stargate-Consul-Examples
echo "Starting API"
docker compose -f api-tests/gs64/docker-compose.yml up -d api
sleep 10
echo "Testing API"
curl --fail http://localhost:8080/echo/hello
curl --fail http://localhost:8500/v1/agent/services
curl --fail http://localhost:8500/v1/health/checks/echo
HEALTH_STATUS=$(curl -s http://localhost:8500/v1/health/checks/echo | jq '.[0].Status')
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != '"passing"' ]; then
echo "Error: Echo service is unhealthy" >&2
docker compose -f api-tests/gs64/docker-compose.yml down
exit 1
fi
docker compose -f api-tests/gs64/docker-compose.yml down
10 changes: 5 additions & 5 deletions compose-test.sh → compose-test-pharo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
set -e

echo "Building API"
docker compose -f api-tests/docker-compose.yml build api
docker compose -f api-tests/pharo/docker-compose.yml build api
echo "Starting Consul Agent"
docker compose -f api-tests/docker-compose.yml up -d consul-agent
docker compose -f api-tests/pharo/docker-compose.yml up -d consul-agent
sleep 1
echo "Starting API"
docker compose -f api-tests/docker-compose.yml up -d api
docker compose -f api-tests/pharo/docker-compose.yml up -d api
sleep 10
echo "Testing API"
curl --fail http://localhost:8080/echo/hello
Expand All @@ -18,7 +18,7 @@ HEALTH_STATUS=$(curl -s http://localhost:8500/v1/health/checks/echo | jq '.[0].S
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != '"passing"' ]; then
echo "Error: Echo service is unhealthy" >&2
docker compose -f api-tests/docker-compose.yml down
docker compose -f api-tests/pharo/docker-compose.yml down
exit 1
fi
docker compose -f api-tests/docker-compose.yml down
docker compose -f api-tests/pharo/docker-compose.yml down
2 changes: 2 additions & 0 deletions docker/gs64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM ghcr.io/ba-st/launchpad-gs64:v5
CMD [ "launchpad", "start", "stargate-consul-example" ]
File renamed without changes.

0 comments on commit 5f8d289

Please sign in to comment.