Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
✅ node integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
bohendo committed Oct 29, 2020
1 parent 4c5d4b1 commit ae31c74
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Config & sensitive data
*.config.json
modules/browser-node-test-ui/config-node.json
.*.sqlite

# Build Output
**/*.0x
Expand Down
40 changes: 32 additions & 8 deletions ops/start-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ project=$(grep -m 1 '"name":' "$root/package.json" | cut -d '"' -f 4)
docker swarm init 2> /dev/null || true
docker network create --attachable --driver overlay "$project" 2> /dev/null || true

if grep -qs "${project}_node\>" <<<"$(docker container ls --filter 'status=running' --format '{{.ID}} {{.Names}}')"
then echo "A vector node is already running" && exit 0;
fi

####################
# Load config

Expand Down Expand Up @@ -86,6 +90,19 @@ node_public_port="${public_port:-8001}"
public_url="http://127.0.0.1:$node_public_port/ping"
echo "node will be exposed on *:$node_public_port"

if [[ "$production" == "true" ]]
then
node_image_name="${project}_node:$version"
mount_root=""
entrypoint=""
arg=""
else
node_image_name="${project}_builder:$version"
mount_root="--volume=$root:/root"
entrypoint="--entrypoint=bash"
arg="modules/server-node/ops/entry.sh"
fi

node_image_name="${project}_node:$version"
bash "$root/ops/pull-images.sh" "$node_image_name" > /dev/null

Expand All @@ -96,11 +113,13 @@ bash "$root/ops/pull-images.sh" "$node_image_name" > /dev/null
# If we're using local evms, the node shouldn't perist data either
if [[ "$use_local_evms" == "true" ]]
then
db_file="/data/store.sqlite"
mount="--mount=$root/.node.sqlite:/data/store.sqlite"
local_db_file="$root/.node.sqlite"
internal_db_file="/data/store.sqlite"
touch "$local_db_file"
mount_db="--volume=$local_db_file:$internal_db_file"
else
db_file="/tmp/store.sqlite"
mount=""
internal_db_file="/tmp/store.sqlite"
mount_db=""
fi

####################
Expand All @@ -113,16 +132,21 @@ else echo "Running in non-interactive mode"
fi

docker run \
"$mount" \
"$entrypoint" \
"$mount_db" \
"$mount_root" \
"${interactive[@]}" \
--network="$project" \
--detach \
--env="VECTOR_CONFIG=$(echo "$config" | tr -d '\n\r')" \
--env="VECTOR_DATABASE_URL=sqlite://$db_file" \
--env="VECTOR_DATABASE_URL=sqlite://$internal_db_file" \
--env="VECTOR_MNEMONIC=$eth_mnemonic" \
--env="VECTOR_PROD=$production" \
--name="${project}_node" \
--network="$project" \
--publish="$node_public_port:$node_internal_port" \
--rm \
--tmpfs="/tmp" \
"${project}_node:$version"
"$node_image_name" "$arg"

echo "The node has been deployed, waiting for $public_url to start responding.."
timeout=$(( $(date +%s) + 60 ))
Expand Down
2 changes: 1 addition & 1 deletion ops/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ common=(
"--env=VECTOR_DAVE_URL=http://dave:8000"
"--env=VECTOR_LOG_LEVEL=${LOG_LEVEL:-error}"
"--env=VECTOR_MESSAGING_URL=http://messaging"
"--env=VECTOR_NODE_URL=http://node:8000"
"--env=VECTOR_NODE_URL=http://vector_node:8000"
"--env=VECTOR_PROD=${production}"
"--env=VECTOR_ROGER_URL=http://roger:8000"
"--env=VECTOR_ROUTER_URL=http://router:8000"
Expand Down

0 comments on commit ae31c74

Please sign in to comment.