소스 검색

test scripts use root docker-compose to join same network

Mokhtar Naamani 3 년 전
부모
커밋
79b05bb731

+ 3 - 0
.env

@@ -52,3 +52,6 @@ DISTRIBUTOR_1_WORKER_ID=0
 DISTRIBUTOR_1_ACCOUNT_URI=//testing//worker//Distribution//${DISTRIBUTOR_1_WORKER_ID}
 DISTRIBUTOR_2_WORKER_ID=1
 DISTRIBUTOR_2_ACCOUNT_URI=//testing//worker//Distribution//${DISTRIBUTOR_2_WORKER_ID}
+
+# joystream/node docker image tag
+JOYSTREAM_NODE_TAG=latest

+ 1 - 1
docker-compose.yml

@@ -4,7 +4,7 @@
 version: '3.4'
 services:
   joystream-node:
-    image: joystream/node:latest
+    image: joystream/node:$JOYSTREAM_NODE_TAG
     build:
       # context is relative to the compose file
       context: .

+ 0 - 2
tests/network-tests/.env

@@ -54,8 +54,6 @@ SLASH_AMOUNT = 2
 STAKE_DECREMENT = 3
 # Mint capacity increment value for working gorup mint capacity test
 MINT_CAPACITY_INCREMENT = 1000
-# Storage node address to download content from
-STORAGE_NODE_URL = http://localhost:3001/asset/v0
 # Mini-secret or mnemonic used in SURI for deterministic key derivation
 SURI_MINI_SECRET = ""
 # The starting key id to use when running a scenario. This will allow scenario

+ 1 - 1
tests/network-tests/.gitignore

@@ -1,2 +1,2 @@
 output.json
-
+data/

+ 0 - 64
tests/network-tests/run-local-node-test.sh

@@ -1,64 +0,0 @@
-# Location that will be mounted as the /data volume in containers
-# This is how we access the initial members and balances files from
-# the containers and where generated chainspec files will be located.
-DATA_PATH="test-data"
-
-# Initial account balance for Alice
-# Alice is the source of funds for all new accounts that are created in the tests.
-ALICE_INITIAL_BALANCE=100000000
-
-rm -Rf ${DATA_PATH}
-mkdir -p ${DATA_PATH}
-
-echo "{
-  \"balances\":[
-    [\"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", ${ALICE_INITIAL_BALANCE}]
-  ]
-}" > ${DATA_PATH}/initial-balances.json
-
-# Make Alice a member
-echo '
-  [{
-    "member_id": 0,
-    "root_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
-    "controller_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
-    "handle":"alice_with_a_long_handle",
-    "avatar_uri":"https://alice.com/avatar.png",
-    "about":"Alice",
-    "name": "Alice",
-    "registered_at_time": 0
-  },
-  {
-    "member_id": 1,
-    "root_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
-    "controller_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
-    "handle":"bob_with_a_long_handle",
-    "avatar_uri":"https://bob.com/avatar.png",
-    "about":"Bob",
-    "name": "Bob",
-    "registered_at_time": 0
-  }
-]
-' > ${DATA_PATH}/initial-members.json
-
-# Create a chain spec file
-./target/release/chain-spec-builder generate -a 2 -e 2 -k ${DATA_PATH} --chain-spec-path ${DATA_PATH}/chain-spec.json --initial-balances-path ${DATA_PATH}/initial-balances.json --initial-members-path ${DATA_PATH}/initial-members.json --deployment live > ${DATA_PATH}/seeds
-
-jq -c '.id = "js_babylon_test"' ${DATA_PATH}/chain-spec.json > tmp.$$.json && mv tmp.$$.json ${DATA_PATH}/chain-spec.json
-jq -c '.protocolId = "js/babylon/test"' ${DATA_PATH}/chain-spec.json > tmp.$$.json && mv tmp.$$.json ${DATA_PATH}/chain-spec.json
-
-timeout 3s ./target/release/joystream-node --base-path ${DATA_PATH}/alice3  --validator --chain ${DATA_PATH}/chain-spec.json
-
-
-timeout 3s ./target/release/joystream-node --base-path ${DATA_PATH}/bob4  --validator --port 30334 --ws-port 9945 --chain ${DATA_PATH}/chain-spec.json
-
-
-mv  ${DATA_PATH}/auth-0/* ${DATA_PATH}/alice3/chains/js_babylon_test/keystore
-mv  ${DATA_PATH}/auth-1/* ${DATA_PATH}/bob4/chains/js_babylon_test/keystore
-
-rm -Rf ${DATA_PATH}/alice3/chains/js_babylon_test/db
-rm -Rf ${DATA_PATH}/bob4/chains/js_babylon_test/db
-
-# RUN
-#./target/release/joystream-node --base-path test-data/alice3  --validator --chain test-data/chain-spec.json --pruning=archive --log runtime,txpool,transaction-pool
-#./target/release/joystream-node --base-path test-data/bob4 --validator --port 30334 --ws-port 9945 --chain test-data/chain-spec.json --pruning=archive --log runtime,txpool,transaction-pool

+ 5 - 8
tests/network-tests/run-migration-tests.sh

@@ -56,15 +56,12 @@ docker run --rm -v ${DATA_PATH}:/data joystream/node:${RUNTIME} build-spec \
   --raw --disable-default-bootnode \
   --chain /data/chain-spec.json > ~/tmp/chain-spec-raw.json
 
-NETWORK_ARG=
-if [ "$ATTACH_TO_NETWORK" != "" ]; then
-  NETWORK_ARG="--network ${ATTACH_TO_NETWORK}"
-fi
-
 # Start a chain with generated chain spec
-# Add "-l ws=trace,ws::handler=info" to get websocket trace logs
-CONTAINER_ID=`docker run -d -v ${DATA_PATH}:/data -p 9944:9944 ${NETWORK_ARG} --name joystream-node joystream/node:${RUNTIME} \
-  --validator --alice --unsafe-ws-external --rpc-cors=all -l runtime \
+export JOYSTREAM_NODE_TAG=${RUNTIME}
+CONTAINER_ID=`docker-compose -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/data --name joystream-node \
+  -p 9944:9944 -p 9933:9933 joystream-node \
+  --alice --validator --unsafe-ws-external --unsafe-rpc-external \
+  --rpc-methods Unsafe --rpc-cors=all -l runtime \
   --chain /data/chain-spec-raw.json`
 
 function cleanup() {

+ 0 - 50
tests/network-tests/run-storage-node-tests.sh

@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-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
-    # see any possible errors
-    (echo "## Processor Logs ##" && docker logs joystream_processor_1 --tail 50) || :
-    (echo "## Indexer Logs ##" && docker logs joystream_indexer_1 --tail 50) || :
-    docker-compose down -v
-}
-
-trap cleanup EXIT
-
-# clean start
-docker-compose down -v
-
-docker-compose up -d joystream-node
-
-# Storage node
-DEBUG=joystream:storage-cli:dev yarn storage-cli dev-init
-docker-compose up -d colossus
-
-# Query node is expected to have been already built
-docker-compose up -d db
-yarn workspace query-node-root db:migrate
-docker-compose up -d graphql-server
-# Starting up processor will bring up all services it depends on
-docker-compose up -d processor
-
-# Fixes Error: No active storage providers available
-echo "Wait for colossus to announce public url"
-sleep 6
-
-echo "Creating channel..."
-yarn joystream-cli media:createChannel \
-  --input ./assets/TestChannel.json --confirm
-
-echo "Uploading video..."
-yes | yarn joystream-cli media:uploadVideo ./assets/joystream.MOV \
-  --input ./assets/TestVideo.json \
-  --confirm 
-
-time DEBUG=* yarn workspace network-tests run-test-scenario storage-node

+ 9 - 4
tests/network-tests/run-test-node.sh

@@ -1,13 +1,18 @@
+#!/usr/bin/env bash
+set -e
+
+SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
+cd $SCRIPT_PATH
+
 # Location that will be mounted as the /data volume in containers
 # This is how we access the initial members and balances files from
 # the containers and where generated chainspec files will be located.
-DATA_PATH="test-data"
+DATA_PATH=${DATA_PATH:=./data}
 
 # Initial account balance for Alice
 # Alice is the source of funds for all new accounts that are created in the tests.
 ALICE_INITIAL_BALANCE=100000000
 
-rm -Rf ${DATA_PATH}
 mkdir -p ${DATA_PATH}
 
 echo "{
@@ -48,12 +53,12 @@ function cleanup() {
 trap cleanup EXIT
 
 # Create a chain spec file
-./target/release/chain-spec-builder new -a Alice \
+../../target/release/chain-spec-builder new -a Alice \
   --chain-spec-path ${DATA_PATH}/chain-spec.json \
   --initial-balances-path ${DATA_PATH}/initial-balances.json \
   --initial-members-path ${DATA_PATH}/initial-members.json \
   --deployment dev \
   --sudo-account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
 
-./target/release/joystream-node --base-path ${DATA_PATH}/alice \
+../../target/release/joystream-node --base-path ${DATA_PATH}/alice \
   --validator --chain ${DATA_PATH}/chain-spec.json --alice --unsafe-ws-external --rpc-cors all

+ 5 - 8
tests/network-tests/run-tests.sh

@@ -53,15 +53,12 @@ docker run --rm -v ${DATA_PATH}:/data joystream/node:${RUNTIME} build-spec \
   --raw --disable-default-bootnode \
   --chain /data/chain-spec.json > ~/tmp/chain-spec-raw.json
 
-NETWORK_ARG=
-if [ "$ATTACH_TO_NETWORK" != "" ]; then
-  NETWORK_ARG="--network ${ATTACH_TO_NETWORK}"
-fi
-
 # Start a chain with generated chain spec
-# Add "-l ws=trace,ws::handler=info" to get websocket trace logs
-CONTAINER_ID=`docker run -d -v ${DATA_PATH}:/data -p 9944:9944 ${NETWORK_ARG} --name joystream-node joystream/node:${RUNTIME} \
-  --validator --alice --unsafe-ws-external --rpc-cors=all -l runtime \
+export JOYSTREAM_NODE_TAG=${RUNTIME}
+CONTAINER_ID=`docker-compose -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/data --name joystream-node \
+  -p 9944:9944 -p 9933:9933 joystream-node \
+  --alice --validator --unsafe-ws-external --unsafe-rpc-external \
+  --rpc-methods Unsafe --rpc-cors=all -l runtime \
   --chain /data/chain-spec-raw.json`
 
 function cleanup() {

+ 5 - 9
tests/network-tests/test-setup-new-chain.sh

@@ -55,16 +55,12 @@ docker run --rm -v ${DATA_PATH}:/data joystream/node:${RUNTIME} build-spec \
   --raw --disable-default-bootnode \
   --chain /data/chain-spec.json > ~/tmp/chain-spec-raw.json
 
-NETWORK_ARG=
-if [ "$ATTACH_TO_NETWORK" != "" ]; then
-  NETWORK_ARG="--network ${ATTACH_TO_NETWORK}"
-fi
-
-echo "starting joystream-node container"
 # Start a chain with generated chain spec
-# Add "-l ws=trace,ws::handler=info" to get websocket trace logs
-CONTAINER_ID=`docker run -d -v ${DATA_PATH}:/data -p 9944:9944 ${NETWORK_ARG} --name joystream-node joystream/node:${RUNTIME} \
-  --validator --alice --unsafe-ws-external --rpc-cors=all -l runtime \
+export JOYSTREAM_NODE_TAG=${RUNTIME}
+CONTAINER_ID=`docker-compose -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/data --name joystream-node \
+  -p 9944:9944 -p 9933:9933 joystream-node \
+  --alice --validator --unsafe-ws-external --unsafe-rpc-external \
+  --rpc-methods Unsafe --rpc-cors=all -l runtime \
   --chain /data/chain-spec-raw.json`
 
 function cleanup() {