Skip to content

Commit

Permalink
Merge pull request #17 from mnaamani/colossus-s3-api-integration-test…
Browse files Browse the repository at this point in the history
…s-fix

fix integration tests
  • Loading branch information
mrBovo authored Aug 28, 2024
2 parents 5038ae4 + 5c7bc1a commit 6e1f6e0
Show file tree
Hide file tree
Showing 19 changed files with 90 additions and 82 deletions.
7 changes: 6 additions & 1 deletion docker-compose-no-bind-volumes.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Complete joystream development network
version: '3.4'
services:
joystream-node:
image: joystream/node:$JOYSTREAM_NODE_TAG
Expand Down Expand Up @@ -37,6 +36,9 @@ services:
- ACCOUNT_URI=${COLOSSUS_1_TRANSACTOR_URI}
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://apm-server:8200
# - OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production
- AWS_BUCKET_NAME=test-bucket-1
- LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT}
- LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED}
entrypoint: ['yarn']
command: [
'start', '--worker=${COLOSSUS_1_WORKER_ID}', '--port=3333', '--uploads=/data/uploads',
Expand Down Expand Up @@ -106,6 +108,9 @@ services:
environment:
# ACCOUNT_URI overrides command line arg --accountUri
- ACCOUNT_URI=${COLOSSUS_2_TRANSACTOR_URI}
- AWS_BUCKET_NAME=test-bucket-2
- LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT}
- LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED}
entrypoint: ['yarn', 'storage-node']
command: [
'server', '--worker=${COLOSSUS_2_WORKER_ID}', '--port=3333', '--uploads=/data/uploads',
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
# Ref: https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docker.html
elasticsearch:
Expand Down
8 changes: 2 additions & 6 deletions docker-compose.localstack.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
version: '3.4'
services:
localstack:
container_name: local_stack
image: localstack/localstack:3
image: localstack/localstack:3.3
network_mode: bridge
environment:
- SERVICES=s3 # we only need s3 bucket
- DEBUG=1
- DEFAULT_REGION=${AWS_REGION}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT}
- LOCALSTACK_HOST=${LOCALSTACK_HOST}
ports:
- 4566:4566
volumes:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.storage-squid.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
squid_db:
container_name: squid_db
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Complete joystream development network
version: '3.4'
services:
joystream-node:
image: joystream/node:$JOYSTREAM_NODE_TAG
Expand Down Expand Up @@ -37,6 +36,9 @@ services:
- ACCOUNT_URI=${COLOSSUS_1_TRANSACTOR_URI}
- OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT}
- OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production
- AWS_BUCKET_NAME=test-bucket-1
- LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT}
- LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED}
entrypoint: ['/joystream/entrypoints/storage.sh']
command:
[
Expand Down Expand Up @@ -114,6 +116,9 @@ services:
environment:
# ACCOUNT_URI overrides command line arg --accountUri
- ACCOUNT_URI=${COLOSSUS_2_TRANSACTOR_URI}
- AWS_BUCKET_NAME=test-bucket-2
- LOCALSTACK_ENDPOINT=${LOCALSTACK_ENDPOINT}
- LOCALSTACK_ENABLED=${LOCALSTACK_ENABLED}
entrypoint: ['yarn', 'storage-node']
command:
[
Expand Down
12 changes: 6 additions & 6 deletions query-node/kill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

# Only remove query-node related services
docker-compose -f ../docker-compose.yml rm -vsf processor
docker-compose -f ../docker-compose.yml rm -vsf graphql-server
docker-compose -f ../docker-compose.yml rm -vsf indexer
docker-compose -f ../docker-compose.yml rm -vsf hydra-indexer-gateway
docker-compose -f ../docker-compose.yml rm -vsf redis
docker-compose -f ../docker-compose.yml rm -vsf db
docker compose -f ../docker-compose.yml rm -vsf processor
docker compose -f ../docker-compose.yml rm -vsf graphql-server
docker compose -f ../docker-compose.yml rm -vsf indexer
docker compose -f ../docker-compose.yml rm -vsf hydra-indexer-gateway
docker compose -f ../docker-compose.yml rm -vsf redis
docker compose -f ../docker-compose.yml rm -vsf db
docker volume rm joystream_query-node-data
4 changes: 2 additions & 2 deletions query-node/reset-processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH

docker-compose -f ../docker-compose.yml rm -vsf processor
docker-compose -f ../docker-compose.yml rm -vsf graphql-server
docker compose -f ../docker-compose.yml rm -vsf processor
docker compose -f ../docker-compose.yml rm -vsf graphql-server
docker exec db psql -U postgres -c "DROP DATABASE query_node_processor;"
./start.sh
10 changes: 5 additions & 5 deletions query-node/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ cd $SCRIPT_PATH
[ ! -d "generated/" ] && yarn build

# Bring up db
docker-compose -f ../docker-compose.yml up -d db
docker compose -f ../docker-compose.yml up -d db
echo "Waiting for the db to be ready..."
sleep 5

# Start indexer and gateway
docker-compose -f ../docker-compose.yml up -d indexer
docker-compose -f ../docker-compose.yml up -d hydra-indexer-gateway
docker compose -f ../docker-compose.yml up -d indexer
docker compose -f ../docker-compose.yml up -d hydra-indexer-gateway

# Start processor
docker-compose -f ../docker-compose.yml up -d 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
docker compose -f ../docker-compose.yml up -d graphql-server
echo "Waiting for graphql-server to be ready..." && sleep 30
6 changes: 3 additions & 3 deletions scripts/save-to-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
set -e

# clean start
docker-compose -f ../docker-compose.yml down -v
docker compose -f ../docker-compose.yml down -v

function cleanup() {
docker-compose -f ../docker-compose.yml down -v
docker compose -f ../docker-compose.yml down -v
}

trap cleanup EXIT
Expand All @@ -21,7 +21,7 @@ if [[ -z $JOYSTREAM_NODE_TAG ]]; then
fi

# start node image, network and volume
docker-compose -f ../docker-compose.yml up -d joystream-node
docker compose -f ../docker-compose.yml up -d joystream-node

# copy native runtime
docker cp ../target/release/joystream-node joystream-node:/joystream/node
Expand Down
14 changes: 7 additions & 7 deletions start-elasticsearch-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ELASTIC_USERNAME=${ELASTIC_USERNAME:="elastic"}
ELASTIC_PASSWORD=${ELASTIC_PASSWORD:="password"}

# Remove elasticsearch stack containers & volumes
docker-compose -f ./docker-compose.elasticsearch.yml down -v
docker compose -f ./docker-compose.elasticsearch.yml down -v

# Run docker-compose to start elasticsearch container
docker-compose -f ./docker-compose.elasticsearch.yml up -d elasticsearch
# Run docker compose to start elasticsearch container
docker compose -f ./docker-compose.elasticsearch.yml up -d elasticsearch

echo 'Waiting for Elasticsearch...'

Expand Down Expand Up @@ -46,10 +46,10 @@ export ELASTICSEARCH_SERVICEACCOUNTTOKEN=$(echo $response_body | jq -r '.token.v

echo 'Starting for Kibana...'

## Run docker-compose to start kibana container
docker-compose -f ./docker-compose.elasticsearch.yml up -d kibana
## Run docker compose to start kibana container
docker compose -f ./docker-compose.elasticsearch.yml up -d kibana

echo 'Starting APM Server...'

## Run docker-compose to start apm-server container
docker-compose -f ./docker-compose.elasticsearch.yml up -d apm-server
## Run docker compose to start apm-server container
docker compose -f ./docker-compose.elasticsearch.yml up -d apm-server
20 changes: 10 additions & 10 deletions start-multistorage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ else
function down()
{
# Stop containers and clear volumes
docker-compose -f ./docker-compose.storage-squid.yml down -v
docker-compose down -v
docker compose -f ./docker-compose.storage-squid.yml down -v
docker compose down -v
}

trap down EXIT ERR SIGINT SIGTERM
Expand All @@ -34,7 +34,7 @@ fi
if [ "${SKIP_NODE}" != true ]
then
## Run a local development chain
docker-compose up -d joystream-node
docker compose up -d joystream-node
fi

## Query Node Infrastructure
Expand All @@ -44,7 +44,7 @@ fi
./start-orion.sh

## Storage Squid
docker-compose -f ./docker-compose.storage-squid.yml up -d
docker compose -f ./docker-compose.storage-squid.yml up -d

## Init the chain with some state
if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then
Expand All @@ -58,19 +58,19 @@ if [[ $SKIP_CHAIN_SETUP != 'true' ]]; then

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

## Storage Infrastructure Nodes
docker-compose up -d colossus-1
docker-compose up -d distributor-1
docker-compose up -d colossus-2
docker-compose up -d distributor-2
docker compose up -d colossus-1
docker compose up -d distributor-1
docker compose up -d colossus-2
docker compose up -d distributor-2
fi

if [ "${PERSIST}" == true ]
then
echo "All services started in the background"
echo "Remember to run 'docker-compose down -v' to kill all docker services before starting new playground."
echo "Remember to run 'docker compose down -v' to kill all docker services before starting new playground."
else
echo "use Ctrl+C to shutdown the development network."
while true; do
Expand Down
16 changes: 8 additions & 8 deletions start-orion.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
set -e

docker-compose up -d orion-db
docker-compose up -d orion-processor
docker-compose up -d orion-graphql-api
docker-compose up -d orion-auth-api
docker-compose up -d squid-archive-ingest
docker-compose up -d squid-archive-db
docker-compose up -d squid-archive-gateway
docker-compose up -d squid-archive-explorer
docker compose up -d orion-db
docker compose up -d orion-processor
docker compose up -d orion-graphql-api
docker compose up -d orion-auth-api
docker compose up -d squid-archive-ingest
docker compose up -d squid-archive-db
docker compose up -d squid-archive-gateway
docker compose up -d squid-archive-explorer
16 changes: 8 additions & 8 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ else
function down()
{
# Stop containers and clear volumes
docker-compose -f ./docker-compose.storage-squid.yml down -v
docker-compose down -v
docker compose -f ./docker-compose.storage-squid.yml down -v
docker compose down -v
}

trap down EXIT ERR SIGINT SIGTERM
Expand All @@ -36,7 +36,7 @@ fi
if [ "${SKIP_NODE}" != true ]
then
## Run a local development chain
docker-compose up -d joystream-node
docker compose up -d joystream-node
fi

## Query Node Infrastructure
Expand All @@ -46,7 +46,7 @@ fi
./start-orion.sh

## Storage Squid
docker-compose -f ./docker-compose.storage-squid.yml up -d
docker compose -f ./docker-compose.storage-squid.yml up -d

## Init the chain with some state
if [[ $SKIP_CHAIN_SETUP != true ]]; then
Expand All @@ -58,17 +58,17 @@ if [[ $SKIP_CHAIN_SETUP != true ]]; then

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

## Storage Infrastructure Nodes
docker-compose up -d colossus-1
docker-compose up -d distributor-1
docker compose up -d colossus-1
docker compose up -d distributor-1
fi

if [ "${PERSIST}" == true ]
then
echo "All services started in the background"
echo "Remember to run 'docker-compose down -v' to kill all docker services before starting new playground."
echo "Remember to run 'docker compose down -v' to kill all docker services before starting new playground."
else
echo "use Ctrl+C to shutdown the development network."
while true; do
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/*
.venv/
2 changes: 1 addition & 1 deletion tests/network-tests/run-node-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ docker run --pull never --rm -v ${DATA_PATH}:/spec joystream/node:${RUNTIME} bui

# Start a chain with generated chain spec
export JOYSTREAM_NODE_TAG=${RUNTIME}
docker-compose -p joystream -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/spec --name joystream-node \
docker compose -p joystream -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/spec --name joystream-node \
--service-ports joystream-node \
--alice --validator --unsafe-ws-external --unsafe-rpc-external \
--rpc-methods Unsafe --rpc-cors=all -l runtime \
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 @@ -68,7 +68,7 @@ function create_raw_chain_spec() {

# Start a chain with generated chain spec
function start_joystream_node {
docker-compose -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/spec \
docker compose -f ../../docker-compose.yml run -d -v ${DATA_PATH}:/spec \
--name joystream-node \
-p 9944:9944 -p 9933:9933 joystream-node \
--validator --unsafe-ws-external --unsafe-rpc-external \
Expand Down Expand Up @@ -140,7 +140,7 @@ function init_chain_db() {
# if the initial state is large.
# exporting should give some essential tasks errors but they are harmless https://github.com/paritytech/substrate/issues/10583
echo >&2 "exporting state"
docker-compose -f ../../docker-compose.yml run --rm \
docker compose -f ../../docker-compose.yml run --rm \
-v ${DATA_PATH}:/spec joystream-node export-state \
--chain /spec/chain-spec-forked.json \
--base-path /data --pruning archive >${DATA_PATH}/exported-state.json
Expand Down
9 changes: 4 additions & 5 deletions tests/network-tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ function cleanup() {
docker logs colossus-2 --tail 100 || :

if [ "${NO_STORAGE}" != true ]; then
docker-compose -f ../../docker-compose.storage-squid.yml down -v
docker-compose -f ../../docker-compose.localstack.yml down -v
docker compose -f ../../docker-compose.storage-squid.yml down -v
docker compose -f ../../docker-compose.localstack.yml down -v
fi

docker-compose -f ../../docker-compose.yml down -v
docker compose -f ../../docker-compose.yml down -v
}

trap cleanup EXIT ERR SIGINT SIGTERM

export JOYSTREAM_NODE_TAG=${JOYSTREAM_NODE_TAG:-latest}
RUNTIME_PROFILE=TESTING ../../scripts/runtime-code-shasum.sh
export JOYSTREAM_NODE_TAG=`RUNTIME_PROFILE=TESTING ../../scripts/runtime-code-shasum.sh`
CHAIN=dev docker compose -f ../../docker-compose.yml up -d joystream-node

sleep 30
Expand Down
Loading

0 comments on commit 6e1f6e0

Please sign in to comment.