-
Notifications
You must be signed in to change notification settings - Fork 0
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
16 changed files
with
436 additions
and
2 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/allure-results | ||
/allure-report | ||
/docker |
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,35 @@ | ||
name: Run Journey Tests on GitHub | ||
|
||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
jobs: | ||
build: | ||
name: run-tests | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
- name: Setup the tests | ||
run: npm i | ||
- name: Start docker compose | ||
run: docker compose up --wait-timeout 300 -d --quiet-pull | ||
- name: Run the tests | ||
run: | | ||
npm run test:github | ||
npm run report | ||
- name: debug | ||
if: failure() | ||
run: | | ||
docker compose logs > logs.txt | ||
docker ps |
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,2 +1,3 @@ | ||
package-lock.json | ||
node_modules | ||
docker |
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,108 @@ | ||
################################################################################ | ||
# Docker Compose file for starting up the service for testing in GitHub workflow | ||
# This template provides comparable infrastructure to the real environment. | ||
# - mongodb | ||
# - redis | ||
# - localstack (s3, sqs, sns) | ||
# | ||
# Both mongo and localstack have init scripts included for setting up resources | ||
# on startup. These scripts are in docker/scripts. | ||
# | ||
# It also includes a selenium-chrome container for running the browser headless. | ||
# | ||
# The services being tested can either be started up here using the latest | ||
# builds from dockerhub. | ||
# In the example each service has a .env config file in docker/config/ | ||
# Services can reference each other by their container names. | ||
# e.g. http://cdp-example-node-backend:3001/ | ||
# | ||
################################################################################ | ||
services: | ||
|
||
################################################################################ | ||
# Headless browser, used by the test suite to actually run the tests against the | ||
# containers. | ||
selenium-chrome: | ||
image: selenium/standalone-chrome:latest | ||
ports: | ||
- 4444:4444 | ||
|
||
################################################################################ | ||
mongodb: | ||
image: mongo:6 | ||
volumes: | ||
- ./docker/scripts/mongodb:/docker-entrypoint-initdb.d | ||
healthcheck: | ||
test: ["CMD", "mongosh", "--eval", "db.hello().ok"] | ||
interval: 5s | ||
start_period: 5s | ||
retries: 3 | ||
################################################################################ | ||
localstack: | ||
image: localstack/localstack:3.2.0 | ||
environment: | ||
- LOCALSTACK_HOST=127.0.0.1 | ||
- SERVICES=s3,sqs,sns,dynamodb | ||
- LS_LOG=WARN | ||
env_file: | ||
- ./docker/config/defaults.env | ||
volumes: | ||
- ./docker/scripts/localstack:/etc/localstack/init/ready.d | ||
healthcheck: | ||
test: ["CMD", "curl", "localhost:4566"] | ||
interval: 5s | ||
start_period: 5s | ||
retries: 3 | ||
|
||
################################################################################ | ||
redis: | ||
image: redis:7 | ||
restart: always | ||
healthcheck: | ||
test: [ "CMD", "redis-cli", "PING" ] | ||
interval: 5s | ||
start_period: 2s | ||
retries: 5 | ||
|
||
|
||
################################################################################ | ||
# | ||
# Add the services you want to test below. | ||
# | ||
################################################################################ | ||
# cdp-example-node-frontend: | ||
# image: defradigital/cdp-example-node-frontend:latest | ||
# env_file: | ||
# - ./docker/config/defaults.env | ||
# - ./docker/config/example-frontend.env | ||
# environment: | ||
# - PORT=3000 | ||
# depends_on: | ||
# cdp-example-node-backend: | ||
# condition: service_started | ||
# redis: | ||
# condition: service_healthy | ||
# ports: | ||
# - 3000:3000 | ||
# healthcheck: | ||
# test: ["CMD", "curl", "http://localhost:3000/health"] | ||
# interval: 3s | ||
# start_period: 2s | ||
# retries: 3 | ||
|
||
################################################################################ | ||
# cdp-example-node-backend: | ||
# image: defradigital/cdp-example-node-backend:latest | ||
# env_file: | ||
# - ./docker/config/defaults.env | ||
# - ./docker/config/example-backend.env | ||
# environment: | ||
# - PORT=3001 | ||
# depends_on: | ||
# mongodb: | ||
# condition: service_healthy | ||
# healthcheck: | ||
# test: ["CMD", "curl", "http://localhost:3001/health"] | ||
# interval: 3s | ||
# start_period: 2s | ||
# retries: 3 |
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 @@ | ||
# MongoDB | ||
MONGO_URI=mongodb://mongodb:27017/?tls=false | ||
Mongo__DatabaseUri=mongodb://mongodb:27017/?tls=false | ||
|
||
# Redis | ||
REDIS_HOST=redis | ||
USE_SINGLE_INSTANCE_CACHE=true | ||
|
||
# Localstack/AWS | ||
LOCALSTACK_URL=http://localstack:4566 | ||
SNS_ENDPOINT=http://localstack:4566 | ||
SQS_ENDPOINT=http://localstack:4566 | ||
S3_ENDPOINT=http://localstack:4566 | ||
|
||
AWS_ACCESS_KEY_ID=test | ||
AWS_SECRET_ACCESS_KEY=test | ||
AWS_SECRET_KEY=test | ||
AWS_REGION=eu-west-2 | ||
|
||
# Placeholder trust store cert | ||
TRUSTSTORE_CDP_ROOT_CA=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUI5akNDQVYrZ0F3SUJBZ0lVS1I4MkxndGtOQmNjZHlwWUQyNks4N3paK3ZZd0RRWUpLb1pJaHZjTkFRRUUKQlFBd0RURUxNQWtHQTFVRUN3d0NSVkF3SGhjTk1Ua3dPVEkyTURJd05EVXlXaGNOTVRreE1ESTJNREl3TkRVeQpXakFOTVFzd0NRWURWUVFMREFKRlVEQ0JuekFOQmdrcWhraUc5dzBCQVFFRkFBT0JqUUF3Z1lrQ2dZRUF3S3ZhCk5aQ09HY3VZOTAvQnVkUytxUWljK0EzMXVNOG1MdG1JNjBSMWlFamdFV0dCQ3hTaURiMmg4bVFKaVh3a3VsOVcKZWJhYXpQN2hrcWtkTm9KZ1YvNk5FNysrR0t5eVM4ZkloSmdlV1NiNkVlbE1GaGpRMG5aS3piWlg1bXMzSTkxbgp0d3prY0h0S0NRaS9naS9Sb3VobGsvUC9RVmNyelNnSFVIcUpOeTBDQXdFQUFhTlRNRkV3SFFZRFZSME9CQllFCkZISGJncW5uaG0zR0FKNGd5Mkl1RUR4cEx5ZTdNQjhHQTFVZEl3UVlNQmFBRkhIYmdxbm5obTNHQUo0Z3kySXUKRUR4cEx5ZTdNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVFQlFBRGdZRUFHNUNvcWNFeQoxNXZVcGo1VmZKZVIvRFM3MHRQSWlucC9UQ0M5a1JPLysrVFNuUGJxVmNmUHI4dkl5YzRMM01QS2pYRkJzZWZFCnZ0ZkhHR3VjVnR2NU4xKzRVL2I5TnhORmJ1SDJNUDdXM3N3WjRXTTcyTmErVzZpT2h3ZXNPcjBwM0ljT2Z4YzMKUk5DbmFnRm10YkRGeEFsUFhRMGQrbStONWd4TFJvQ1gxaEU9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K |
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 @@ | ||
S3_BUCKET=test-bucket |
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 @@ | ||
EXAMPLE_BACKEND_URL=http://example-node-backend:3001 |
Empty file.
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,6 @@ | ||
#!/bin/bash | ||
|
||
# This is an example of how to setup localstack resources on startup. | ||
# Uncomment the below to create a localstack S3 bucket called 'example-bucket' | ||
|
||
# aws --endpoint-url=$LOCALSTACK_URL s3 --region $AWS_REGION mb s3://example-bucket |
Empty file.
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,7 @@ | ||
/** | ||
* Mongodb script for inserting test data into the docker-compose mongo instance | ||
*/ | ||
|
||
db = db.getSiblingDB('test') | ||
|
||
db.test.insertOne({ test: 'data' }) |
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
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
Oops, something went wrong.