Skip to content

Commit

Permalink
Refactor the way we run ts tests (#2487)
Browse files Browse the repository at this point in the history
* Refactor way we run ts tests
  • Loading branch information
Traf333 committed Feb 13, 2024
1 parent ee67522 commit 8df8650
Show file tree
Hide file tree
Showing 23 changed files with 40 additions and 53 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ jobs:
- test_name: lit-di-vc-test
- test_name: lit-parentchain-nonce
- test_name: lit-ii-batch-test
- test_name: lit-test-stress-script
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion tee-worker/cli/lit_ts_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ pnpm run build

cd /ts-tests
pnpm install
pnpm --filter integration-tests run $TEST:staging
NODE_ENV=staging pnpm --filter integration-tests run $TEST
2 changes: 1 addition & 1 deletion tee-worker/cli/lit_ts_worker_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ echo "Using node endpoint: $NODE_ENDPOINT"

cd /ts-tests
pnpm install
pnpm --filter worker run $TEST:staging
NODE_ENV=staging pnpm --filter worker run $TEST
2 changes: 1 addition & 1 deletion tee-worker/docker/lit-data-provider-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_integration_test.sh test-data-provider 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh data-provider.test.ts 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
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_integration_test.sh test-di-bitcoin-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_bitcoin_identity.test.ts 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_integration_test.sh test-di-evm-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_evm_identity.test.ts 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_integration_test.sh test-di-evm-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_evm_identity.test.ts 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_integration_test.sh test-di-substrate-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_substrate_identity.test.ts 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_integration_test.sh test-di-substrate-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_substrate_identity.test.ts 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_integration_test.sh test-di-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_vc.test.ts 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_integration_test.sh test-di-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh di_vc.test.ts 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_integration_test.sh test-ii-batch 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_batch.test.ts 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_integration_test.sh test-ii-batch 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_batch.test.ts 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_integration_test.sh test-ii-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_identity.test.ts 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_integration_test.sh test-ii-identity 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_identity.test.ts 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_integration_test.sh test-ii-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_vc.test.ts 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_integration_test.sh test-ii-vc 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh ii_vc.test.ts 2>&1' "
restart: "no"
networks:
litentry-test-network:
Expand Down
4 changes: 2 additions & 2 deletions tee-worker/docker/lit-resume-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ services:
condition: service_healthy
networks:
- litentry-test-network
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_worker_test.sh test-resuming-worker 2>&1' "
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_worker_test.sh resuming_worker.test.ts 2>&1' "
restart: "no"
networks:
litentry-test-network:
driver: bridge
driver: bridge
16 changes: 10 additions & 6 deletions tee-worker/ts-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ pnpm install

## Usage(ts-tests folder)

II identity test: `pnpm --filter integration-tests run test-ii-identity:local`
```
pnpm --filter integration-tests run test your-testfile.test.ts
```

II identity test: `pnpm --filter integration-tests run test ii_identity.test.ts`

II vc test: `pnpm --filter integration-tests run test-ii-vc:local`
II vc test: `pnpm --filter integration-tests run test ii_vc.test.ts`

II batch identity test: `pnpm --filter integration-tests run test-ii-batch:local`
II batch identity test: `pnpm --filter integration-tests run test ii_batch.test.ts`

Direct invocation substrate identity test: `pnpm --filter integration-tests run test-di-substrate-identity:local`
Direct invocation substrate identity test: `pnpm --filter integration-tests run test di_substrate_identity.test.ts`

Direct invocation evm identity test: `pnpm --filter integration-tests run test-di-evm-identity:local`
Direct invocation evm identity test: `pnpm --filter integration-tests run test di_evm_identity.test.ts`

Direct invocation vc test: `pnpm --filter integration-tests run test-di-vc:local`
Direct invocation vc test: `pnpm --filter integration-tests run test di_vc.test.ts`
2 changes: 1 addition & 1 deletion tee-worker/ts-tests/integration-tests/common/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dotenv from 'dotenv';

// eslint-disable-next-line @typescript-eslint/no-var-requires, no-undef
dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
dotenv.config({ path: `.env.${process.env.NODE_ENV || 'local'}` });
22 changes: 4 additions & 18 deletions tee-worker/ts-tests/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,10 @@
"license": "ISC",
"type": "module",
"scripts": {
"check-format": "pnpm exec prettier --check .",
"format": "pnpm exec prettier --write .",
"test-ii-identity:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'ii_identity.test.ts'",
"test-ii-identity:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm --loader=ts-node/esm 'ii_identity.test.ts'",
"test-di-substrate-identity:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_substrate_identity.test.ts'",
"test-di-substrate-identity:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_substrate_identity.test.ts'",
"test-di-evm-identity:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_evm_identity.test.ts'",
"test-di-evm-identity:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_evm_identity.test.ts'",
"test-di-bitcoin-identity:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'di_bitcoin_identity.test.ts'",
"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-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'",
"test-ii-batch:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'ii_batch.test.ts'",
"test-data-provider:local": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'data-provider.test.ts'",
"test-data-provider:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'data-provider.test.ts'"
"check-format": "prettier --check .",
"format": "prettier --write .",
"pretest": "eslint .",
"test": "mocha --exit --sort -r ts-node/register --loader=ts-node/esm"
},
"dependencies": {
"@noble/ed25519": "^1.7.3",
Expand Down
9 changes: 4 additions & 5 deletions tee-worker/ts-tests/stress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"license": "ISC",
"type": "module",
"scripts": {
"format": "pnpm exec prettier --write .",
"check-format": "pnpm exec prettier --check .",
"run-script": "NODE_TLS_REJECT_UNAUTHORIZED=0 pnpm exec ts-node bin/stress.ts",
"test-stress-script:local": "pnpm exec cross-env NODE_ENV=local mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'test/test.ts'",
"test-stress-script:staging": "pnpm exec cross-env NODE_ENV=staging mocha --exit --sort -r ts-node/register --loader=ts-node/esm 'test/test.ts'"
"format": "prettier --write .",
"check-format": "prettier --check .",
"run-script": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node bin/stress.ts",
"test": "mocha --exit --sort -r ts-node/register --loader=ts-node/esm"
},
"dependencies": {
"@noble/ed25519": "^1.7.3",
Expand Down
7 changes: 3 additions & 4 deletions tee-worker/ts-tests/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"license": "ISC",
"type": "module",
"scripts": {
"format": "pnpm exec prettier --write .",
"check-format": "pnpm exec prettier --check .",
"test-resuming-worker:staging": "pnpm exec eslint . && pnpm exec cross-env NODE_ENV=staging mocha --trace-warnings --full-trace --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'"
"format": "prettier --write .",
"check-format": "prettier --check .",
"test": "mocha --trace-warnings --full-trace --exit --sort -r ts-node/register --loader=ts-node/esm"
},
"dependencies": {
"chai": "^4.3.6",
Expand Down

0 comments on commit 8df8650

Please sign in to comment.