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

Storage integration tests improvements #4835

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ Modify the root `package.json` and change volta section to use node version 16.2

```sh
# Build local npm packages
yarn build:packages
yarn build

# Build joystream/node docker testing image
RUNTIME_PROFILE=TESTING yarn build:node:docker

# Start a local development network
RUNTIME_PROFILE=TESTING yarn start
yarn start
```

## Software
Expand Down Expand Up @@ -111,13 +111,13 @@ Look under the 'Assets' section:

```bash
# Make sure yarn packages are built
yarn build:packages
yarn build

# Build the test joystream-node
RUNTIME_PROFILE=TESTING yarn build:node:docker

# Run tests
./tests/network-tests/run-full-tests.sh
yarn test
```

### Contributing
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"scripts": {
"build:node:docker": "./build-node-docker.sh",
"build:packages": "./build-packages.sh",
"build": "yarn build:packages",
"setup": "./setup.sh",
"start": "./start.sh",
"test": "./tests/network-tests/run-tests.sh",
"cargo-checks": "./scripts/cargo-checks.sh",
"cargo-build": "./scripts/cargo-build.sh",
"lint": "./scripts/lint-typescript.sh",
Expand Down
11 changes: 6 additions & 5 deletions query-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ GRAPHQL_PLAYGROUND_CDN="query/server" yarn workspace query-node-root query-node:
Run integration tests

```
./query-node/run-tests.sh
./tests/network-tests/run-tests.sh
```

To run tests and keep services alive for further inspection, set `DEBUG` shell variable to any true-ish value.
To run tests and keep services alive for further inspection, set `PERSIST` shell variable to any true-ish value.

```
DEBUG=true ./query-node/run-tests.sh
PERSIST=true ./tests/network-tests/run-tests.sh
```

You can then use queries manually in GraphQL Playground (http://localhost:8081/graphql),
Expand All @@ -87,8 +87,9 @@ This assumes the scenario is repeatable and any previous test errors didn't brea
the blockchain or processor state in a critical way.

```
DEBUG=true ./query-node/run-tests.sh # run tests first and make sure services stay alive
REUSE_KEYS=true yarn workspace network-tests run-test-scenario content-directory
# run tests first and make sure services stay alive
PERSIST=true ./tests/network-tests/run-tests.sh
yarn workspace network-tests run-test-scenario content-directory
```

Commenting out some of the scenario's flow calls in `network-tests/src/scenarios/content-directory.ts` is not relevant to the current
Expand Down
42 changes: 0 additions & 42 deletions query-node/run-tests.sh

This file was deleted.

4 changes: 4 additions & 0 deletions query-node/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ docker-compose -f ../docker-compose.yml up -d hydra-indexer-gateway
# Start processor
docker-compose -f ../docker-compose.yml up -d processor
echo "Waiting for processor to be ready..." && sleep 30
if [[ "$OSTYPE" == "darwin"* ]]; then
# On Docker Desktop things take a bit longer to startup
sleep 150
fi

# Start graphql-server
docker-compose -f ../docker-compose.yml up -d graphql-server
Expand Down
10 changes: 8 additions & 2 deletions start-multistorage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env bash
set -e

SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

rm tests/network-tests/keys.json || :

# Run a complete joystream development network on your machine using docker
export RUNTIME_PROFILE=${RUNTIME_PROFILE:=TESTING}
export JOYSTREAM_NODE_TAG=${JOYSTREAM_NODE_TAG:=$(./scripts/runtime-code-shasum.sh)}

INIT_CHAIN_SCENARIO=${INIT_CHAIN_SCENARIO:=setupNewChainMultiStorage}
Expand Down Expand Up @@ -29,7 +35,7 @@ fi
./query-node/start.sh

## Orion
./start-orion.sh
# ./start-orion.sh

## Init the chain with some state
if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
Expand All @@ -42,7 +48,7 @@ if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
./tests/network-tests/run-test-scenario.sh ${INIT_CHAIN_SCENARIO}

## Member faucet
export INVITER_KEY=$(cat ./tests/network-tests/output.json | jq -r .faucet.suri)
export INVITER_KEY=$(cat ./tests/network-tests/keys.json | jq -r .faucet.suri)
docker-compose up -d faucet

## Storage Infrastructure Nodes
Expand Down
15 changes: 0 additions & 15 deletions start-qn-orion-faucet.sh

This file was deleted.

10 changes: 8 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env bash
set -e

SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

rm tests/network-tests/keys.json || :

# Run a complete joystream development network on your machine using docker
export RUNTIME_PROFILE=${RUNTIME_PROFILE:=TESTING}
export JOYSTREAM_NODE_TAG=${JOYSTREAM_NODE_TAG:=$(./scripts/runtime-code-shasum.sh)}

INIT_CHAIN_SCENARIO=${INIT_CHAIN_SCENARIO:=setupNewChain}
Expand Down Expand Up @@ -29,7 +35,7 @@ fi
./query-node/start.sh

## Orion
./start-orion.sh
# ./start-orion.sh

## Init the chain with some state
if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
Expand All @@ -40,7 +46,7 @@ if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
./tests/network-tests/run-test-scenario.sh ${INIT_CHAIN_SCENARIO}

## Member faucet
export INVITER_KEY=$(cat ./tests/network-tests/output.json | jq -r .faucet.suri)
export INVITER_KEY=$(cat ./tests/network-tests/keys.json | jq -r .faucet.suri)
docker-compose up -d faucet

## Storage Infrastructure Nodes
Expand Down
1 change: 1 addition & 0 deletions tests/network-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output.json
data/
**/generated/*
keys.json
1 change: 1 addition & 0 deletions tests/network-tests/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.tmp/
data/
output.json
keys.json
1 change: 1 addition & 0 deletions tests/network-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"build": "yarn generate:all && tsc --noEmit",
"test": "./run-tests.sh",
"run-test-scenario": "./run-test-scenario.sh",
"run-flow": "./run-fow.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",
Expand Down
9 changes: 9 additions & 0 deletions tests/network-tests/run-flow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e

SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

# Execute the flow scenario
time DEBUG=integration-tests:* yarn workspace network-tests \
node-ts-strict src/scenarios/flow.ts $1
63 changes: 0 additions & 63 deletions tests/network-tests/run-full-tests.sh

This file was deleted.

2 changes: 2 additions & 0 deletions tests/network-tests/run-node-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

rm ./keys.json || :

# Log only to stderr
# Only output from this script should be the container id of the node at the very end

Expand Down
4 changes: 2 additions & 2 deletions tests/network-tests/run-runtime-upgrade-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

rm ./keys.json || :

# Log only to stderr
# Only output from this script should be the container id of the node at the very end

Expand Down Expand Up @@ -187,8 +189,6 @@ function main {
# 6. Bootstrap storage infra because we need to run content-directory tests after runtime upgrade
if [ "${NO_STORAGE}" != true ]; then
./start-storage.sh
export REUSE_KEYS=true
export SKIP_STORAGE_AND_DISTRIBUTION=true
fi

./run-test-scenario.sh runtimeUpgrade
Expand Down
2 changes: 2 additions & 0 deletions tests/network-tests/run-test-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

rm ./keys.json || :

# Location used to store chain data, generated spec file and initial members
# and balances for the test chain.
DATA_PATH=./data
Expand Down
7 changes: 4 additions & 3 deletions tests/network-tests/run-test-scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ cd $SCRIPT_PATH
# pass the scenario name without .ts extension
SCENARIO=$1
# fallback if scenario not specified
SCENARIO=${SCENARIO:="content-directory"}
SCENARIO=${SCENARIO:="full"}

# Execute the tests
time DEBUG=integration-tests:* yarn workspace network-tests node-ts-strict src/scenarios/${SCENARIO}.ts
# Execute the scenario and optional arguments after following scenario name
time DEBUG=integration-tests:* yarn workspace network-tests \
node-ts-strict src/scenarios/${SCENARIO}.ts $2 $3 $4 $5
Loading
Loading