Skip to content

Commit

Permalink
Merge pull request #1295 from input-output-hk/chore/e2e-tests-change-…
Browse files Browse the repository at this point in the history
…order

LW-10615 Optimize e2e tests
  • Loading branch information
iccicci committed May 23, 2024
2 parents 360d34a + 52fd132 commit d0430f2
Show file tree
Hide file tree
Showing 46 changed files with 207 additions and 189 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/continuous-integration-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: 🔨 Build
run: |
yarn install --immutable --inline-builds
yarn install --immutable --inline-builds --mode=skip-build
yarn build
docker build --no-cache .
env:
Expand All @@ -67,18 +67,24 @@ jobs:
OGMIOS_URL: 'ws://ogmios:1340'
POSTGRES_PORT: '5435'

- name: Wait for some epochs
- name: Wait for network init
run: |
yarn workspace @cardano-sdk/e2e wait-for-network
env:
DB_SYNC_CONNECTION_STRING: 'postgresql://postgres:doNoUseThisSecret!@localhost:5435/cexplorer'
yarn workspace @cardano-sdk/e2e wait-for-network-init
- name: 🔬 Test - e2e - wallet
- name: 🔬 Test - e2e - wallet at epoch 0
run: |
yarn workspace @cardano-sdk/e2e test:wallet
yarn workspace @cardano-sdk/e2e test:providers
yarn workspace @cardano-sdk/e2e test:wallet:epoch0
yarn workspace @cardano-sdk/e2e test:projection
- name: Wait for epoch 3
run: |
yarn workspace @cardano-sdk/e2e wait-for-network-epoch-3
- name: 🔬 Test - e2e - wallet at epoch 3
run: |
yarn workspace @cardano-sdk/e2e test:wallet:epoch3
yarn workspace @cardano-sdk/e2e test:pg-boss
yarn workspace @cardano-sdk/e2e test:providers
env:
STAKE_POOL_PROVIDER_URL: 'http://localhost:4000/'

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/continuous-integration-side-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Continuous Integration - Side Tests

env:
TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }}
TL_LEVEL: ${{ github.event.pull_request.head.repo.fork && 'info' || vars.TL_LEVEL }}

on:
pull_request:
push:
branches: ['master']
tags: ['*.*.*']

jobs:
build_and_test:
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: 🧰 Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.0

- name: 🔨 Build
run: |
yarn install --immutable --inline-builds --mode=skip-build
yarn build
env:
NODE_OPTIONS: '--max_old_space_size=8192'

- name: 🔃 Check for circular dependencies
run: |
yarn circular-deps:check
- name: 🔬 Test
run: |
yarn lint
yarn test:build:verify
yarn workspace @cardano-sdk/cardano-services test:cli
env:
NODE_OPTIONS: '--max_old_space_size=8192'
9 changes: 1 addition & 8 deletions .github/workflows/continuous-integration-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: 🔨 Build
run: |
yarn install --immutable --inline-builds
yarn install --immutable --inline-builds --mode=skip-build
yarn build
env:
NODE_OPTIONS: '--max_old_space_size=8192'
Expand All @@ -36,18 +36,11 @@ jobs:
run: |
git checkout yarn-project.nix
if [ ! -z "$(git status --porcelain)" ] ; then git status ; echo "The PR is missing some generated file" ; exit 1 ; fi
yarn lint
env:
NODE_OPTIONS: '--max_old_space_size=8192'

- name: 🔃 Check for circular dependencies
run: |
yarn circular-deps:check
- name: 🔬 Test
run: |
yarn test:build:verify
yarn test --forceExit
yarn workspace @cardano-sdk/cardano-services test:cli
env:
NODE_OPTIONS: '--max_old_space_size=8192'
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ FROM ubuntu-nodejs as nodejs-builder
RUN \
curl --proto '=https' --tlsv1.2 -sSf -L https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
apt-get update && apt-get install pkg-config libusb-1.0 libudev-dev gcc g++ make gnupg2 yarn -y &&\
yarn global add node-gyp@9.0.0
apt-get update && apt-get install yarn -y
WORKDIR /app
COPY build build
COPY packages/cardano-services/package.json packages/cardano-services/package.json
Expand Down Expand Up @@ -118,10 +117,12 @@ WORKDIR /config
COPY compose/schedules.json .
ENV SCHEDULES=/config/schedules.json
WORKDIR /app/packages/cardano-services
HEALTHCHECK CMD curl -s --fail http://localhost:3003/v1.0.0/health
CMD ["node", "dist/cjs/cli.js", "start-pg-boss-worker"]

FROM cardano-services as projector
WORKDIR /
COPY compose/projector/init.* ./
RUN chmod 755 init.sh
HEALTHCHECK CMD test `curl -fs http://localhost:3000/v1.0.0/health | jq -r ".services[0].projectedTip.blockNo"` -gt 1
CMD ["./init.sh"]
33 changes: 2 additions & 31 deletions compose/common.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

x-from-sdk: &from-sdk
healthcheck:
interval: 10s
Expand Down Expand Up @@ -30,7 +28,7 @@ x-provider-server: &provider-server
target: provider-server
depends_on:
cardano-db-sync:
condition: service_healthy
condition: service_started

x-with-postgres: &with-postgres
depends_on:
Expand Down Expand Up @@ -113,19 +111,12 @@ services:
depends_on:
ogmios:
condition: service_healthy
healthcheck:
test: ['CMD', '/scripts/is-db-synced.sh']
interval: 5s
timeout: 1s
retries: 120
start_period: 100ms
image: ghcr.io/intersectmbo/cardano-db-sync:${CARDANO_DB_SYNC_VERSION:-13.1.0.2}
restart: on-failure
stop_signal: SIGINT
volumes:
- db-sync-data:/var/lib/cexplorer
- node-ipc:/node-ipc
- ../../packages/e2e/local-network/scripts:/scripts

cardano-smash:
<<:
Expand All @@ -142,7 +133,7 @@ services:
SMASH_PASSWORD: ${SMASH_PASSWORD:-change_m}
depends_on:
cardano-db-sync:
condition: service_healthy
condition: service_started
ports:
- ${SMASH_PORT:-3100}:3100
restart: on-failure
Expand Down Expand Up @@ -214,8 +205,6 @@ services:
STAKE_POOL_PROVIDER_URL: http://provider-server:3000/
METADATA_FETCH_MODE: ${METADATA_FETCH_MODE:-smash}
SMASH_URL: ${SMASH_URL:-http://cardano-smash:3100/api/v1}
healthcheck:
test: ['CMD-SHELL', 'curl -s --fail http://localhost:3003/v1.0.0/health']
ports:
- ${PG_BOSS_PORT:-4003}:3003

Expand Down Expand Up @@ -254,12 +243,6 @@ services:
- *sdk-environment
POSTGRES_DB_FILE: /run/secrets/postgres_db_asset
PROJECTION_NAMES: asset
healthcheck:
test:
[
'CMD-SHELL',
'test `curl -fs http://localhost:3000/v1.0.0/health | jq -r ".services[0].projectedTip.blockNo"` -gt 1'
]
ports:
- ${ASSET_PROJECTOR_PORT:-4006}:3000

Expand All @@ -275,12 +258,6 @@ services:
- *sdk-environment
POSTGRES_DB_FILE: /run/secrets/postgres_db_handle
PROJECTION_NAMES: handle
healthcheck:
test:
[
'CMD-SHELL',
'test `curl -fs http://localhost:3000/v1.0.0/health | jq -r ".services[0].projectedTip.blockNo"` -gt 1'
]
ports:
- ${HANDLE_PROJECTOR_PORT:-4004}:3000

Expand All @@ -296,12 +273,6 @@ services:
- *sdk-environment
POSTGRES_DB_FILE: /run/secrets/postgres_db_stake_pool
PROJECTION_NAMES: stake-pool,stake-pool-metadata-job,stake-pool-metrics-job,stake-pool-rewards-job
healthcheck:
test:
[
'CMD-SHELL',
'test `curl -fs http://localhost:3000/v1.0.0/health | jq -r ".services[0].projectedTip.blockNo"` -gt 1'
]
ports:
- ${STAKE_POOL_PROJECTOR_PORT:-4002}:3000

Expand Down
2 changes: 0 additions & 2 deletions packages/cardano-services/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

x-logging: &logging
logging:
driver: 'json-file'
Expand Down
6 changes: 1 addition & 5 deletions packages/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

x-logging: &logging
logging:
driver: 'json-file'
Expand Down Expand Up @@ -68,9 +66,6 @@ services:
- ./local-network/config/network:/config

cardano-smash:
depends_on:
cardano-db-sync:
condition: service_healthy
volumes:
- ./local-network/config/network:/config

Expand Down Expand Up @@ -113,6 +108,7 @@ services:
stake-pool-projector:
environment:
METADATA_JOB_RETRY_DELAY: 60
POOLS_METRICS_INTERVAL: 50

volumes:
sdk-ipc:
Expand Down
5 changes: 3 additions & 2 deletions packages/e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ module.exports = {
project('pg-boss'),
project('projection'),
project('providers'),
project('wallet'),
project('wallet_epoch_0'),
project('wallet_epoch_3'),
{
...commonProjectProps,
displayName: 'wallet-real-ada',
testMatch: [`<rootDir>/test/wallet/PersonalWallet/(${realAdaTestFileNames.join('|')}).test.ts`]
testMatch: [`<rootDir>/test/wallet*/PersonalWallet/(${realAdaTestFileNames.join('|')}).test.ts`]
},
{
...commonProjectProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/local-network/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN apt-get update -y && \
apt-get install -y tzdata ca-certificates jq coreutils curl wget

HEALTHCHECK --interval=5s --timeout=1s --retries=200 --start-period=100ms \
CMD /root/scripts/get-epoch.sh | awk '{ if ($0 >= "3") exit 0; else exit 1}'
CMD test -e /root/network-files/run/healthy

STOPSIGNAL SIGINT
COPY --from=builder /build/cardano-node /opt/cardano-node
Expand Down
24 changes: 0 additions & 24 deletions packages/e2e/local-network/scripts/is-db-synced.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ POOL_COST=410000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="" # Leave it empty and the metadata field will be ignore in the TX

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=370000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=400000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ POOL_COST=390000000
POOL_MARGIN=0.15
METADATA_URL="http://file-server/SP${SP_NODE_ID}.json"

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ POOL_COST=380000000
POOL_MARGIN=0.15
METADATA_URL="" # Leave it empty and the metadata field will be ignore in the TX

source ./scripts/pools/update-node-utils.sh
source ./scripts/pools/update-node-utils.sh ${SP_NODE_ID}

trap clean EXIT

Expand Down
Loading

0 comments on commit d0430f2

Please sign in to comment.