-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
477 additions
and
252 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
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,31 @@ | ||
name: Image test routine | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'dev' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
test-suite: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" | ||
- name: Pull all images | ||
run: | | ||
docker compose pull --ignore-pull-failures | ||
- name: Install test harness | ||
run: | | ||
yarn add leia-parser mocha chai command-line-test | ||
- name: Generate test files | ||
run: | | ||
yarn leia "TESTING*.md" test -r 2 -s 'Start up tests' -t 'Verification commands' -c 'Destroy tests' --split-file | ||
- name: Run docker-compose tests | ||
run: | | ||
yarn mocha --timeout 900000 test/*compose*.func.js |
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,4 @@ | ||
/node_modules | ||
/test | ||
package.json | ||
yarn.lock |
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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
FROM golang:alpine | ||
FROM golang:1.21-alpine | ||
|
||
WORKDIR /go-dbaas | ||
WORKDIR /internal-services-test | ||
|
||
ADD . . | ||
|
||
RUN go get github.com/joho/godotenv | ||
|
||
RUN go build && chmod +x ./go-dbaas | ||
RUN go build && chmod +x ./internal-services-test | ||
|
||
ENV SOLR_HOST=solr \ | ||
REDIS_HOST=redis \ | ||
OPENSEARCH_HOST=opensearch-2 | ||
ENV STORAGE_LOCATION='/app/files' | ||
|
||
EXPOSE 3000 | ||
|
||
CMD sleep 10 && ./go-dbaas | ||
CMD sleep 10 && ./internal-services-test |
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,93 @@ | ||
Docker Compose test internal services test | ||
========================================== | ||
|
||
This is a docker-compose testing suite for the internal services: | ||
|
||
Start up tests | ||
-------------- | ||
|
||
Run the following commands to get up and running with this example. | ||
|
||
```bash | ||
# should remove any previous runs and poweroff | ||
docker compose down --volumes --remove-orphans | ||
|
||
# should start up our services successfully | ||
docker compose build && docker compose up -d | ||
``` | ||
|
||
Verification commands | ||
--------------------- | ||
|
||
Run the following commands to validate things are rolling as they should. | ||
|
||
```bash | ||
# Ensure services are ready to connect | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-5:3306 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mariadb-10-11:3306 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://postgres-11:5432 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://postgres-15:5432 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://opensearch-2:9200 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://mongo-4:27017 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://redis-6:6379 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://redis-7:6379 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://solr-7:8983 -timeout 1m | ||
docker run --rm --net internal-services-test_default jwilder/dockerize dockerize -wait tcp://solr-8:8983 -timeout 1m | ||
|
||
# commons should be running Alpine Linux | ||
docker compose exec -T commons sh -c "cat /etc/os-release" | grep "Alpine Linux" | ||
|
||
# mariadb-10-5 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-5" | grep "SERVICE_HOST=10.5" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-5" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# mariadb-10-11 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "SERVICE_HOST=10.11" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# postgres-11 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-11" | grep "SERVICE_HOST=PostgreSQL 11" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-11" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# postgres-15 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-15" | grep "SERVICE_HOST=PostgreSQL 15" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-15" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# opensearch-2 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch?service=opensearch-2" | grep "SERVICE_HOST=opensearch-2" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/opensearch?service=opensearch-2" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# mongo-4 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo?service=mongo-4" | grep "SERVICE_HOST=" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mongo?service=mongo-4" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# redis-6 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-6" | grep "SERVICE_HOST=redis-6" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-6" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# redis-7 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-7" | grep "SERVICE_HOST=redis-7" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/redis?service=redis-7" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# solr-7 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-7" | grep "SERVICE_HOST=solr-7" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-7" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# solr-8 should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-8" | grep "SERVICE_HOST=solr-8" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/solr?service=solr-8" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
|
||
# persistent storage should be able to read/write data | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/storage?path=/app/files" | grep "STORAGE_PATH=/app/files/storage.txt" | ||
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/storage?path=/app/files" | grep "LAGOON_TEST_VAR=internal-services-test" | ||
``` | ||
|
||
Destroy tests | ||
------------- | ||
|
||
Run the following commands to trash this app like nothing ever happened. | ||
|
||
```bash | ||
# should be able to destroy our services with success | ||
docker compose down --volumes --remove-orphans | ||
``` |
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 |
---|---|---|
@@ -1,48 +1,52 @@ | ||
services: | ||
web: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
labels: | ||
lagoon.type: basic | ||
ports: | ||
- '3000:3000' | ||
container_name: go-web | ||
environment: | ||
- MARIADB_10_4_DRUPAL_USERNAME=drupal | ||
- MARIADB_10_4_DRUPAL_PASSWORD=drupal | ||
- MARIADB_10_4_DRUPAL_DATABASE=drupal | ||
- POSTGRES_SECURE_USERNAME=secure | ||
- POSTGRES_SECURE_PASSWORD=secure | ||
- POSTGRES_SECURE_DATABASE=secure | ||
- POSTGRES_SECURE_HOST=postgres-secure | ||
- POSTGRES_SECURE_PORT=5432 | ||
commons: | ||
image: uselagoon/commons:latest | ||
|
||
mariadb-10-4-drupal: | ||
image: uselagoon/mariadb-10.4-drupal | ||
labels: | ||
lagoon.type: mariadb-single | ||
ports: | ||
- '3306' | ||
environment: | ||
- LAGOON_TEST_VAR=test | ||
- LAGOON_GIT_SHA=SHA256 | ||
- LAGOON_ENVIRONMENT_TYPE=development | ||
# web: | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
# labels: | ||
# lagoon.type: basic | ||
# ports: | ||
# - '3000:3000' | ||
# container_name: go-web | ||
# environment: | ||
# - LAGOON_TEST_VAR="88@oWT47^v0QN6ZuId#rbqLW5h!#P8Zzsf0w@p7I@3B%E6b1A8" | ||
# - MARIADB_10_4_DRUPAL_USERNAME=drupal | ||
# - MARIADB_10_4_DRUPAL_PASSWORD=drupal | ||
# - MARIADB_10_4_DRUPAL_DATABASE=drupal | ||
# - POSTGRES_SECURE_USERNAME=secure | ||
# - POSTGRES_SECURE_PASSWORD=secure | ||
# - POSTGRES_SECURE_DATABASE=secure | ||
# - POSTGRES_SECURE_HOST=postgres-secure | ||
# - POSTGRES_SECURE_PORT=5432 | ||
|
||
mongo-somedb: | ||
image: uselagoon/mongo-4:latest | ||
labels: | ||
lagoon.type: mongo | ||
ports: | ||
- '27017' | ||
# mariadb-10-4-drupal: | ||
# image: uselagoon/mariadb-10.4-drupal | ||
# labels: | ||
# lagoon.type: mariadb-single | ||
# ports: | ||
# - '3306' | ||
# environment: | ||
# - LAGOON_TEST_VAR=test | ||
# - LAGOON_GIT_SHA=SHA256 | ||
# - LAGOON_ENVIRONMENT_TYPE=development | ||
|
||
postgres-secure: | ||
image: testlagoon/postgres-15:main | ||
labels: | ||
lagoon.type: postgres | ||
ports: | ||
- '5432' | ||
environment: | ||
- POSTGRES_PASSWORD=secure | ||
- POSTGRES_USER=secure | ||
- POSTGRES_DB=secure | ||
# mongo-somedb: | ||
# image: uselagoon/mongo-4:latest | ||
# labels: | ||
# lagoon.type: mongo | ||
# ports: | ||
# - '27017' | ||
|
||
# postgres-secure: | ||
# image: testlagoon/postgres-15:main | ||
# labels: | ||
# lagoon.type: postgres | ||
# ports: | ||
# - '5432' | ||
# environment: | ||
# - POSTGRES_PASSWORD=secure | ||
# - POSTGRES_USER=secure | ||
# - POSTGRES_DB=secure |
Oops, something went wrong.