Skip to content

Commit

Permalink
fix(mojaloop/#2734): failures in daily cron job running gp tests (#146)
Browse files Browse the repository at this point in the history
fix(mojaloop/#2734): failures in daily cron job running GP tests - mojaloop/project#2734
- fixed logging to correctly display request logs. this is needed to help debug issues
- re-factored config-loading as this was badly being being handled, which impacted unit/integration tests etc.
- added unit tests for config-loading
- added support for `CONFIG_OVERRIDE` env var to support using example.env for unit/integration tests, with default being `.env` when running `npm start`.

chore: maintenance
- updated dependencies
- updated husky to the latest version, and moved config from package.json to .husky folder
- replaced module-alias with native import alias's
  • Loading branch information
mdebarros committed Sep 8, 2022
1 parent b610286 commit 50ebcad
Show file tree
Hide file tree
Showing 41 changed files with 1,488 additions and 945 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ jobs:
docker-compose build
docker-compose up -d
- run:
name: Sleep for 30 seconds while waiting for docker
name: Wait for services to be running and report healthy
command: |
sleep 30
## wait for services to be up and running
npm run wait-4-docker
- run:
name: Execute integration tests
command: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ jspm_packages
secrets
# Ignore any log files or application data
*.sqlite

# .env configs
**/*.env
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
1 change: 1 addition & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ exclude:
- '**/.eslintrc.js'
- '**/jest.integration.config.js'
- '**/init/**'
- '**/scripts/**'
39 changes: 38 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,62 @@ version: '3'
services:
redis:
image: "redis:5.0.4-alpine"
container_name: redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD" ,"sh", "-c", "redis-cli","ping"]
timeout: 20s
retries: 10
start_period: 40s
interval: 30s

sim:
container_name: simulator
image: "mojaloop-simulator-backend"
build: ./
env_file: ./sim-backend.env
volumes:
- ./src/rules.json:/opt/app/src/rules.json
- ./rules/example.json:/opt/app/rules.json
ports:
- "3000:3000"
- "3001:3001"
- "3003:3003"
depends_on:
- scheme-adapter
user: root # Set Root so we can install Curl for Healthchecks
healthcheck:
test: [
"CMD" ,
"apk", "add", "--no-cache", "curl", # Install curl
"&&",
"curl", "-f", "http://localhost:3000/health" # Check if api is up
]
timeout: 20s
retries: 10
start_period: 40s
interval: 30s

scheme-adapter:
container_name: scheme-adapter
image: "mojaloop/sdk-scheme-adapter:latest"
env_file: ./scheme-adapter.env
ports:
- "3500:3000"
- "3501:4000"
volumes:
- ./test/secrets:/opt/app/secrets
depends_on:
- redis
user: root # Set Root so we can install Curl for Healthchecks
healthcheck:
test: [
"CMD" ,
"apk", "add", "--no-cache", "curl", # Install curl
"&&",
"curl", "-f", "http://localhost:4001" # Check if api is up
]
timeout: 20s
retries: 10
start_period: 40s
interval: 30s
5 changes: 3 additions & 2 deletions .env → example.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ SQLITE_LOG_FILE=:memory:
# The name of the sqlite model database. If you would like to start the simulator with preloaded
# state you can use a preexisting file. If running in a container, you can mount a sqlite file as a
# volume in the container to preserve state between runs.
# Use MODEL_DATABASE=:memory: for an ephemeral in-memory database
# Use MODEL_DATABASE=:memory: for an ephemeral in-memory database (required for unit tests)
MODEL_DATABASE=./model.sqlite
# MODEL_DATABASE=:memory:

# Obound API endpoint (It might be a container in the compose file so remember the networking IP)
OUTBOUND_ENDPOINT=http://scheme-adapter:3001

DFSP_ID=golden
FEE_MULTIPLIER=0.05

RULES_FILE=./rules.json
RULES_FILE=../rules/example.json
Loading

0 comments on commit 50ebcad

Please sign in to comment.