Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/jest parallel integration tests #325

Open
wants to merge 100 commits into
base: feature/OTC
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
6c5839e
JEST Parallel testing PoC
claudio-viola Aug 31, 2020
d80ad5b
Jest combined coverage reports
claudio-viola Sep 2, 2020
17131ca
Fixed test parallelization, server now can be shutdown gracefully, re…
claudio-viola Sep 10, 2020
e7e23b9
Merge
claudio-viola Sep 10, 2020
b999e95
Using combined code coverage in pipeline
claudio-viola Sep 10, 2020
3b34c9b
Updating circleci pipeline
claudio-viola Sep 10, 2020
f8b78b5
Updating circleci pipeline
claudio-viola Sep 10, 2020
a5bc6e6
Updating package.json
claudio-viola Sep 10, 2020
1c8977a
parallel test automatic pull of migration files from central ledger
claudio-viola Sep 11, 2020
efa9df6
Updating circle ci pipeline
claudio-viola Sep 11, 2020
edeaed6
Fixing configuration
claudio-viola Sep 11, 2020
e448550
Fixing configuration
claudio-viola Sep 11, 2020
52098b5
Fixing configuration
claudio-viola Sep 11, 2020
522d00c
Fixing configuration
claudio-viola Sep 11, 2020
a7cf997
Fixing configuration
claudio-viola Sep 11, 2020
1d7a307
Fixing configuration
claudio-viola Sep 11, 2020
da2e0c7
Updating test scripts to wait for mysql and refactoring
claudio-viola Sep 14, 2020
171584e
Circleci update installing default dependencies
claudio-viola Sep 14, 2020
602e081
update installing node-gyp
claudio-viola Sep 15, 2020
a716711
removed temporarily setup step
claudio-viola Sep 15, 2020
0ca6eaf
removed temporarily setup step
claudio-viola Sep 15, 2020
87e1670
Temp disabling of ci
claudio-viola Sep 15, 2020
1d6517d
Adding rebuild step
claudio-viola Sep 15, 2020
1e0e5ab
Adding node version check step
claudio-viola Sep 15, 2020
74f2850
Ubuntu default dependencies
claudio-viola Sep 15, 2020
e993922
Ubuntu default dependencies
claudio-viola Sep 15, 2020
c6f76e9
Ubuntu default dependencies
claudio-viola Sep 15, 2020
da8b798
Ubuntu default dependencies
claudio-viola Sep 15, 2020
3ebaa5b
Ubuntu default dependencies
claudio-viola Sep 15, 2020
0260b0d
Added glibc
claudio-viola Sep 15, 2020
323e1b9
Installing libc6
claudio-viola Sep 15, 2020
93471a4
testing unsafe-perm option
claudio-viola Sep 15, 2020
0d90463
replacing gcc
claudio-viola Sep 15, 2020
555222b
Fix version of gcc
claudio-viola Sep 15, 2020
8dda297
Fix version of gcc
claudio-viola Sep 15, 2020
3038999
Updating to use docker for tests
claudio-viola Sep 15, 2020
6e6d92a
updating to use docker for testing
claudio-viola Sep 16, 2020
89ef851
Added scripts to run tests in docker
claudio-viola Sep 16, 2020
ac673c0
Using early preview ubuntu
claudio-viola Sep 16, 2020
91c4c2b
Revert back ubuntu image
claudio-viola Sep 16, 2020
07dd917
Add latest docker-compose version
claudio-viola Sep 16, 2020
c5ab1a9
Splitting command
claudio-viola Sep 16, 2020
163caa8
Using branch specific migrations
claudio-viola Sep 16, 2020
ac89362
added docker layer caching
claudio-viola Sep 16, 2020
33149a1
Adding docker layers cache
claudio-viola Sep 16, 2020
778aa77
Reinstating pipeline
claudio-viola Sep 17, 2020
13fe22b
Updated circleci steps
claudio-viola Sep 17, 2020
037553a
Merge with latest feature/OTC
claudio-viola Sep 18, 2020
f1eb365
Added coverage merge script using nyc only and updated circleci for t…
claudio-viola Sep 21, 2020
e22e262
Updated circleci pipeline
claudio-viola Sep 23, 2020
7c1f034
Updated circleci pipeline
claudio-viola Sep 23, 2020
5715bb7
Updated circleci pipeline
claudio-viola Sep 23, 2020
02d683f
Updated circleci pipeline
claudio-viola Sep 23, 2020
9168c9a
fixed wait for mysql script
claudio-viola Sep 23, 2020
1299ce0
Merge branch 'feature/OTC' into feature/jest-parallel-integration-tests
claudio-viola Sep 25, 2020
d6ca0fc
Updating circleci
claudio-viola Sep 25, 2020
bc3bbcb
Changing workspace root
claudio-viola Sep 25, 2020
1fc6db8
Changin root directory
claudio-viola Sep 25, 2020
29e682e
Debugging...
claudio-viola Sep 25, 2020
d0db92a
Testing
claudio-viola Sep 25, 2020
63b9208
Testing
claudio-viola Sep 25, 2020
54f134a
Testing
claudio-viola Sep 25, 2020
3780b5e
Testing
claudio-viola Sep 25, 2020
4708da2
Testing
claudio-viola Sep 25, 2020
bd23ec1
Testing
claudio-viola Sep 25, 2020
15b980b
testing
claudio-viola Sep 25, 2020
e3575eb
testing
claudio-viola Sep 25, 2020
1dc6888
Merge branch 'feature/OTC' into feature/jest-parallel-integration-tests
claudio-viola Sep 25, 2020
5691327
testing
claudio-viola Sep 25, 2020
14ee24b
testing
claudio-viola Sep 25, 2020
a3c3557
testing
claudio-viola Sep 25, 2020
44a2088
testing
claudio-viola Sep 25, 2020
06715d1
testing
claudio-viola Sep 25, 2020
a4e5273
testing
claudio-viola Sep 25, 2020
90828b4
testing
claudio-viola Sep 25, 2020
62991db
Update circleci to use cache for coverage reports
claudio-viola Sep 28, 2020
da995ea
Update circleci to use cache for coverage reports
claudio-viola Sep 28, 2020
249f1aa
testing pipeline
claudio-viola Sep 28, 2020
aace0c8
Update circleci to use cache for coverage reports
claudio-viola Sep 28, 2020
4bad10e
testing pipeline
claudio-viola Sep 28, 2020
fae1d59
Testing pipelines
claudio-viola Sep 29, 2020
dc28a21
Reverting back to single job
claudio-viola Sep 29, 2020
e06d17d
testing
claudio-viola Sep 29, 2020
4410fac
testing
claudio-viola Sep 29, 2020
c226946
Updating pipeline
claudio-viola Sep 29, 2020
bc8bbc0
Updating gitlab ci
claudio-viola Sep 29, 2020
9ebb2e3
Updating gitlab ci
claudio-viola Sep 29, 2020
2e2b7ca
Updating gitlab ci
claudio-viola Sep 29, 2020
b862f61
Updating gitlab ci
claudio-viola Sep 29, 2020
8d9fa8c
Updating gitlab ci
claudio-viola Sep 29, 2020
6e9fa5a
Updating gitlab ci
claudio-viola Sep 29, 2020
957d5fc
Updating gitlab ci
claudio-viola Sep 29, 2020
035c7f1
Updating gitlab ci
claudio-viola Sep 29, 2020
93323d1
Updating gitlab ci
claudio-viola Sep 29, 2020
6f8689e
Updating gitlab ci
claudio-viola Sep 29, 2020
20101d8
Updating gitlab ci
claudio-viola Sep 29, 2020
7b721bd
Updating gitlab ci
claudio-viola Sep 29, 2020
ed22255
Updating gitlab ci
claudio-viola Sep 29, 2020
445cde6
Updating gitlab ci
claudio-viola Sep 30, 2020
0d4f841
modified circleci pipeline
claudio-viola Oct 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 66 additions & 108 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ defaults_Dependencies: &defaults_Dependencies |
npm config set unsafe-perm true
npm install -g node-gyp


defaults_awsCliDependencies: &defaults_awsCliDependencies |
apk upgrade --no-cache
apk --no-cache add \
Expand Down Expand Up @@ -54,7 +55,8 @@ executors:

default-machine:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
image: ubuntu-2004:202008-01

##
# Jobs
Expand Down Expand Up @@ -85,84 +87,66 @@ jobs:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules

test-unit:
executor: default-docker
steps:
- checkout
- run:
name: Install general dependencies
command: *defaults_Dependencies
- restore_cache:
keys:
- dependency-cache-{{ checksum "package.json" }}
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
name: Install tape and tap-xunit
command: npm install -g tape tap-xunit
- run:
name: Install tapes
command: npm install -g tapes
- run:
name: Execute unit tests
command: npm -s run test:xunit > ./test/results/tape.xml
- store_artifacts:
path: ./test/results
prefix: test
- store_test_results:
path: ./test/results

test-coverage:
executor: default-docker
steps:
- checkout
- run:
name: Install general dependencies
command: *defaults_Dependencies
- run:
name: Install AWS CLI dependencies
command: *defaults_awsCliDependencies
- restore_cache:
keys:
- dependency-cache-{{ checksum "package.json" }}
- run:
name: Execute code coverage check
command: npm -s run test:coverage
- store_artifacts:
path: coverage
prefix: test
- store_test_results:
path: coverage
- run:
name: Copy code coverage to SonarQube
command: |
if [ "${CIRCLE_BRANCH}" == "master" ];
then
echo "Sending lcov.info to SonarQube..."
aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/central-settlement/lcov.info
else
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
fi

test-integration:
executor: default-machine
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
name: Execute integration tests
command: npm -s run test:integration
- store_artifacts:
path: ./test/results
prefix: test
- store_test_results:
path: ./test/results
tests:
executor: default-machine
steps:
- checkout
- restore_cache:
keys:
- v1-docker-{{ checksum "package.json" }}
- run:
name: Load Docker layers cache
command: |
set +o pipefail
docker load -i ~/docker-layers.tar | true
- run:
name: Prepare docker environment
command: npm -s run test:int:new:ci:prepare
- run:
name: Save Docker layers cache
command: |
DOCKER_IMAGES=$(docker images --format "{{.Repository}}" --filter=reference="${CIRCLE_PROJECT_REPONAME}_*")
DOCKER_LAYERS=$(for image in $DOCKER_IMAGES; do docker history $image -q | grep -v missing; done)
docker save -o ~/docker-layers.tar $DOCKER_LAYERS
- save_cache:
key: v1-docker-{{ checksum "package.json" }}
paths:
- ~/docker-layers.tar
- run:
name: Execute unit tests
command: docker exec -it cs_central-settlement sh -c "mkdir -p ./test/results && npm -s run test:xunit > ./test/results/tape.xml"
- run:
name: Execute unit tests with coverage
command: docker exec -it cs_central-settlement sh -c "npm run test:coverage"
- run:
name: Copy unit test results
command: mkdir -p ./test/results && docker cp cs_central-settlement:/opt/central-settlement/test/results/ .
- run:
name: Execute narrow integration tests
command: docker exec -it cs_central-settlement sh -c "npm run test:int:new:series:run"
- run:
name: Execute combined tests coverage check
command: docker exec -it cs_central-settlement sh -c "npm run test:coverage:merge && npm run test:coverage:merge:check"
- run:
name: Copy combined coverage results
command: docker cp cs_central-settlement:/opt/central-settlement/coverage_merged/ .
- store_artifacts:
path: ./test/results
prefix: test
- store_test_results:
path: ./test/results
- store_artifacts:
path: ./coverage_merged
- run:
name: Copy code coverage to SonarQube
command: |
if [ "${CIRCLE_BRANCH}" == "master" ];
then
echo "Sending lcov.info to SonarQube..."
aws s3 cp ./coverage_merged/lcov.info $AWS_S3_DIR_SONARQUBE/central-settlement/lcov.info
else
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
fi

vulnerability-check:
executor: default-docker
Expand Down Expand Up @@ -361,32 +345,8 @@ workflows:
ignore:
- /feature*/
- /bugfix*/
- test-unit:
- tests:
context: org-global
requires:
- setup
filters:
tags:
only: /.*/
branches:
ignore:
- /feature*/
- /bugfix*/
- test-coverage:
context: org-global
requires:
- setup
filters:
tags:
only: /.*/
branches:
ignore:
- /feature*/
- /bugfix*/
- test-integration:
context: org-global
requires:
- setup
filters:
tags:
only: /.*/
Expand Down Expand Up @@ -420,9 +380,7 @@ workflows:
context: org-global
requires:
- setup
- test-unit
- test-coverage
- test-integration
- tests
- vulnerability-check
- audit-licenses
filters:
Expand Down Expand Up @@ -471,4 +429,4 @@ workflows:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?/
branches:
ignore:
- /.*/
- /.*/
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage

coverage_*
#Docs folder created for documentation
docs

Expand Down Expand Up @@ -58,3 +58,6 @@ jspm_packages
.history
/.gitlab-ci.env
junit.xml
migrations
seeds
tmp
48 changes: 32 additions & 16 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ stages:
- apk --no-cache add curl
- apk --no-cache add openssh-client
- apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake
- npm config set unsafe-perm true
- npm install -g node-gyp

# Build the image and push it to gitlab package registry
Build:
Expand All @@ -30,25 +28,43 @@ Build:
- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"

# Execute unit tests
Unit Test:
Run Test:
stage: test
image: node:12.16.0-alpine
image: docker:latest
services:
- docker:dind
before_script:
- docker info
- apk update
- apk upgrade
- apk add curl jq python3 python3-dev build-base libffi-dev libressl-dev gettext
- curl -O https://bootstrap.pypa.io/get-pip.py
- python3 get-pip.py
- pip install docker-compose
- apk --no-cache add ca-certificates
- apk --no-cache add curl
- apk --no-cache add openssh-client
script:
- *defaults_Dependencies
# - cd $(npm root -g)/npm
# - npm install --no-save github:interledgerjs/five-bells-ledger-api-tests
- npm install
- apk update && apk --no-cache add git
- mkdir -p ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- sh ./test/int/scripts/pre_start_ci.sh
- docker exec -i cs_central-settlement sh -c "mkdir -p ./test/results && npm -s run test:xunit > ./test/results/tape.xml"
- docker exec -i cs_central-settlement sh -c "npm run test:coverage"
- mkdir -p ./test/results && docker cp cs_central-settlement:/opt/central-settlement/test/results/ .
- docker exec -i cs_central-settlement sh -c "npm run test:int:new:series:run"
- docker exec -i cs_central-settlement sh -c "npm run test:coverage:merge && npm run test:coverage:merge:check"
- docker cp cs_central-settlement:/opt/central-settlement/coverage_combined/ .
# - apk del build-dependencies
# - mkdir -p ./test/results
#- npm install -g tape tap-xunit
#- npm install -g tapes
- npm -s run test:coverage-check
#artifacts:
# paths:
# - ./test/results/*.*
# reports:
# junit:
# - ./test/results/tape.xml
# - npm -s run test:coverage-check
artifacts:
paths:
- ./test/results/*.*
reports:
junit:
- ./test/results/tape.xml


# Deployment requires the mojaloop cluster to be configured in gitlab
Expand All @@ -69,7 +85,7 @@ Deploy to Dev:
# This allows the cluster to pull images from the private repo
# without needing to modify the upstream OSS helm chart to allow specifying image pull credentials
# NOTE: This step requires a deploy token to be created in this project called gitlab-deploy-token
# See https://docs.gitlab.com/ee/user/project/deploy_tokens/index.html#gitlab-deploy-token for details
# See https://docs.gitlab.com/ee/user/project/deploy_tokens/index.html#gitlab-deploy-token for details
# Install coreutils so that we can use the GNU version of base64 and disable line wrapping (-w)
- apk update && apk add coreutils
# Set the required variables and base64 them
Expand Down
23 changes: 23 additions & 0 deletions .nycrc.combined.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# temp-directory: "./.nyc_output"
check-coverage: true
per-file: true
lines: 90
statements: 90
functions: 90
branches: 90
all: true
include: [
"src/**/*.js"
]
instrument: true
reporter: [
"lcov",
"text-summary",
"html"
]
report-dir: "./coverage_combined"
exclude: [
"**/node_modules/**",
'**/migrations/**',
'**/docs/**',
]
2 changes: 1 addition & 1 deletion .nycrc.integration.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
temp-directory: "./.nyc_output"
check-coverage: true
check-coverage: false
per-file: true
lines: 90
statements: 90
Expand Down
2 changes: 1 addition & 1 deletion .nycrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
temp-directory: "./.nyc_output"
check-coverage: true
check-coverage: false
per-file: true
lines: 90
statements: 90
Expand Down
Loading