Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaamani committed Aug 24, 2024
1 parent 196c48c commit a73f483
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ ENABLE_STORAGE_PROVIDER=true
CLOUD_STORAGE_PROVIDER_NAME=aws

# AWS S3 (replace with your own configuration and credentials)
AWS_ACCESS_KEY_ID=test-key
AWS_SECRET_ACCESS_KEY=test-secret
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_REGION=eu-west-1
AWS_BUCKET_NAME=sample-bucket
7 changes: 2 additions & 5 deletions docker-compose.localstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ version: '3.4'
services:
localstack:
container_name: local_stack
image: localstack/localstack
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
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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 +117,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
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/
5 changes: 2 additions & 3 deletions tests/network-tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ function cleanup() {

if [ "${NO_STORAGE}" != true ]; then
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.localstack.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
20 changes: 13 additions & 7 deletions tests/network-tests/start-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,38 @@ TMP=$0
THIS_DIR=$(dirname $TMP)

echo "Staring storage infrastructure"
export LOCALSTACK_ENABLED=true

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

HOST_IP=$($THIS_DIR/get-host-ip.sh)
HOST_IP=`$THIS_DIR/get-host-ip.sh`
export COLOSSUS_1_URL="http://${HOST_IP}:3333"
export DISTRIBUTOR_1_URL="http://${HOST_IP}:3334"
export COLOSSUS_2_URL="http://${HOST_IP}:3335"
export DISTRIBUTOR_2_URL="http://${HOST_IP}:3336"
export LOCALSTACK_ENDPOINT="http://${HOST_IP}:4566"
$THIS_DIR/run-test-scenario.sh initStorageAndDistribution

# give QN time to catch up so nodes can get their initial state
sleep 30

# Start localstack if ENABLE_LOCALSTACK is set to true
export LOCALSTACK_ENABLED=true
export LOCALSTACK_HOST="${HOST_IP}:4566"
export LOCALSTACK_ENDPOINT="http://${LOCALSTACK_HOST}"
docker-compose -f $THIS_DIR/../../docker-compose.localstack.yml up -d localstack && sleep 15
python3 -m venv .venv
pip install awscli-local
source .venv/bin/activate
awslocal s3api create-bucket --bucket test-bucket-1 --endpoint ${LOCALSTACK_ENDPOINT}
awslocal s3api create-bucket --bucket test-bucket-2 --endpoint ${LOCALSTACK_ENDPOINT}
deactivate

# Start colossus & argus
docker-compose -f $THIS_DIR/../../docker-compose.yml up -d colossus-1
docker-compose -f $THIS_DIR/../../docker-compose.yml up -d distributor-1
docker-compose -f $THIS_DIR/../../docker-compose.yml up -d colossus-2
docker-compose -f $THIS_DIR/../../docker-compose.yml up -d distributor-2

# Start localstack if ENABLE_LOCALSTACK is set to true
docker-compose -f $THIS_DIR/../../docker-compose.localstack.yml up -d localstack
awslocal s3api create-bucket --bucket $AWS_BUCKET_NAME --endpoint http://localhost:4566

# allow a few seconds for nodes to startup and display first few log entries
# to help debug tests
sleep 30
Expand Down

0 comments on commit a73f483

Please sign in to comment.