ソースを参照

network-tests: rename scripts and split running scenarion from starting chain

Mokhtar Naamani 4 年 前
コミット
11d1b59f5c

+ 4 - 5
query-node/run-tests.sh

@@ -29,9 +29,6 @@ function cleanup() {
 
 trap cleanup EXIT
 
-# We expect docker image to be started by test runner
-export WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944/
-
 # Bring up db
 docker-compose up -d db
 
@@ -40,8 +37,10 @@ yarn workspace query-node-root db:migrate
 
 docker-compose up -d graphql-server
 
+# Start the joystream-node before the indexer
+docker-compose up -d joystream-node
+
 # Starting up processor will bring up all services it depends on
 docker-compose up -d processor
 
-# Run tests
-ATTACH_TO_NETWORK=joystream_default ../tests/network-tests/run-tests.sh content-directory
+time yarn workspace network-tests run-test-scenario content-directory

+ 3 - 2
tests/network-tests/package.json

@@ -4,8 +4,9 @@
   "license": "GPL-3.0-only",
   "scripts": {
     "build": "tsc --noEmit",
-    "run-tests": "./run-tests.sh",
-    "test-run": "node -r ts-node/register --unhandled-rejections=strict",
+    "test": "./start-test-chain.sh && ./run-tests.sh",
+    "run-test-scenario": "./run-test-scenario.sh",
+    "node-ts-strict": "node -r ts-node/register --unhandled-rejections=strict",
     "lint": "eslint . --quiet --ext .ts",
     "checks": "tsc --noEmit --pretty && prettier ./ --check && yarn lint",
     "format": "prettier ./ --write "

+ 7 - 12
tests/network-tests/run-storage-node-tests.sh

@@ -1,8 +1,12 @@
 #!/usr/bin/env bash
 set -e
 
-# SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
-# cd $SCRIPT_PATH
+SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
+cd $SCRIPT_PATH
+
+set -a
+. ../../.env
+set +a
 
 function cleanup() {
     # Show tail end of logs for the processor and indexer containers to
@@ -14,15 +18,6 @@ function cleanup() {
 
 trap cleanup EXIT
 
-export WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944/
-
-# Only run codegen if no generated files found
-[ ! -d "query-node/generated/" ] && yarn workspace query-node-root build
-
-# Make sure typeorm is available.. it get removed again when yarn is run again
-# typeorm commandline is used by db:migrate step below.
-ln -s ../../../../../node_modules/typeorm/cli.js query-node/generated/graphql-server/node_modules/.bin/typeorm || :
-
 # clean start
 docker-compose down -v
 
@@ -52,4 +47,4 @@ yes | yarn joystream-cli media:uploadVideo ./tests/network-tests/assets/joystrea
   --input ./tests/network-tests/assets/TestVideo.json \
   --confirm 
 
-time DEBUG=* yarn workspace network-tests test-run src/scenarios/storage-node.ts
+time DEBUG=* yarn workspace network-tests run-test-scenario storage-node

+ 13 - 0
tests/network-tests/run-test-scenario.sh

@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -e
+
+SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
+cd $SCRIPT_PATH
+
+# pass the scenario name without .ts extension
+SCENARIO=$1
+# fallback to full.ts scenario if not specified
+SCENARIO=${SCENARIO:=full}
+
+# Execute the tests
+time DEBUG=* yarn workspace network-tests node-ts-strict src/scenarios/${SCENARIO}.ts

+ 0 - 7
tests/network-tests/run-tests.sh → tests/network-tests/start-test-chain.sh

@@ -102,10 +102,3 @@ fi
 # Display runtime version
 yarn workspace api-scripts tsnode-strict src/status.ts | grep Runtime
 
-# pass the scenario name without .ts extension
-SCENARIO=$1
-# fallback to full.ts scenario if not specified
-SCENARIO=${SCENARIO:=full}
-
-# Execute the tests
-time DEBUG=* yarn workspace network-tests test-run src/scenarios/${SCENARIO}.ts