Skip to content

Commit

Permalink
Manual tests of removing the second worker during running (#2316)
Browse files Browse the repository at this point in the history
* resuming worker tests

* move resuming worker test to separate workspace

* correct script name

* add workspace

* fix evm build

* lock file

* fix package.json

* missing worker workspace deps

* adjust bitcoin identity test docker compose

* fix test

* remove unwanted paths from tsconfig.json

* add config

* add tracing

* add more dev deps

* debug

* remove problematic function

* debugging

* add withRetry

* remove sleep

---------

Co-authored-by: Zhouhui Tian <125243011+zhouhuitian@users.noreply.github.com>
  • Loading branch information
kziemianek and outofxxx committed Jan 22, 2024
1 parent b27c864 commit 8969e7e
Show file tree
Hide file tree
Showing 28 changed files with 333 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,6 @@ jobs:
- test_name: lit-parentchain-nonce
- test_name: lit-ii-batch-test
- test_name: lit-test-stress-script
# disabled due to P-208
# - test_name: lit-resume-worker
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -709,6 +707,7 @@ jobs:
- test_name: lit-ii-batch-test-multiworker
- test_name: lit-ii-identity-multiworker-test
- test_name: lit-ii-vc-multiworker-test
- test_name: lit-resume-worker
steps:
- uses: actions/checkout@v4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CLIENT="${CLIENT_BIN} -p ${NPORT} -P ${WORKER1PORT} -u ${NODEURL} -U ${WORKER1UR

function usage() {
echo ""
echo "This is a script for tee-worker ts-test. Preparing to test: $1"
echo "This is a script for tee-worker integration ts tests. Pass test name as first argument"
echo ""

}
Expand Down
25 changes: 25 additions & 0 deletions tee-worker/cli/lit_ts_worker_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Copyright 2020-2023 Trust Computing GmbH.

set -euo pipefail

function usage() {
echo ""
echo "This is a script for tee-worker worker ts-test. Pass test name as first argument"
echo ""
}

[ $# -ne 1 ] && (usage; exit 1)
TEST=$1


BINARY_DIR="/usr/local/bin"
NODE_ENDPOINT="ws://litentry-node:9912"

echo "Using binary dir: $BINARY_DIR"
echo "Using node endpoint: $NODE_ENDPOINT"

cd /ts-tests
pnpm install
pnpm --filter worker run $TEST:staging
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-bitcoin-identity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-bitcoin-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-bitcoin-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-evm-identity-multiworker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-evm-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-evm-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-evm-identity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-evm-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-evm-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-substrate-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-substrate-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-substrate-identity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-substrate-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-substrate-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-vc-multiworker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-vc 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-di-vc-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-di-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-di-vc 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-batch-test-multiworker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-batch 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-batch 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-batch-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-batch 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-batch 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-identity-multiworker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-identity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-identity 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-vc-multiworker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-vc 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-ii-vc-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-ii-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-ii-vc 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
5 changes: 2 additions & 3 deletions tee-worker/docker/lit-resume-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-resuming-worker 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_worker_test.sh test-resuming-worker 2>&1' "
restart: "no"
networks:
litentry-test-network:
driver: bridge
# docker compose -f docker-compose.yml -f resume-worker.yml up relaychain-alice relaychain-bob litentry-node --no-build --exit-code-from resume-worker -- resume-worker
driver: bridge
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-test-stress-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_test.sh test-stress-script 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh test-stress-script 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { KeyringPair } from '@polkadot/keyring/types';
import { ethers } from 'ethers';
import { blake2AsU8a } from '@polkadot/util-crypto';
import bitcore from 'bitcore-lib';
import { IntegrationTestContext } from 'common/common-types';
import { IntegrationTestContext } from './../common-types';
import { buildIdentityHelper } from './identity-helper';

export type KeypairType = 'ed25519' | 'sr25519' | 'ecdsa' | 'ethereum' | 'bitcoin';
Expand Down
2 changes: 0 additions & 2 deletions tee-worker/ts-tests/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"test-di-bitcoin-identity:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_bitcoin_identity.test.ts'",
"test-di-vc:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_vc.test.ts'",
"test-di-vc:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_vc.test.ts'",
"test-resuming-worker:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'resuming_worker.test.ts'",
"test-resuming-worker:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'resuming_worker.test.ts'",
"test-ii-vc:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'ii_vc.test.ts'",
"test-ii-vc:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'ii_vc.test.ts'",
"test-ii-batch:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'ii_batch.test.ts'",
Expand Down
130 changes: 130 additions & 0 deletions tee-worker/ts-tests/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tee-worker/ts-tests/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages: ["integration-tests", "stress"]
packages: ["integration-tests", "stress", "worker"]
3 changes: 3 additions & 0 deletions tee-worker/ts-tests/worker/.env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NODE_ENV = local
NODE_ENDPOINT = "ws://localhost:9944"
BINARY_DIR=/usr/local/bin
4 changes: 4 additions & 0 deletions tee-worker/ts-tests/worker/.env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NODE_ENV=staging
NODE_ENDPOINT="ws://litentry-node:9912"
NODE_TLS_REJECT_UNAUTHORIZED=0
BINARY_DIR=/usr/local/bin
Loading

0 comments on commit 8969e7e

Please sign in to comment.