#!/usr/bin/env bash set -e if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi SO_COMMAND=laconic-so test_name="Fixturenet eth stack deploy test" echo "Running ${test_name}" stack_name=$(pwd)/stack-orchestrator/stacks/fixturenet-eth test_fail_exit () { local fail_message=$1 echo "${test_name}: ${fail_message}" echo "${test_name}: FAILED" exit 1 } # Sanity check the stack dir exists if [ ! -d "${stack_name}" ]; then test_fail_exit "stack directory not present" exit 1 fi # Set a non-default repo dir export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir reported_version_string=$( $SO_COMMAND version ) echo "SO version is: ${reported_version_string}" echo "Cloning repositories into: $CERC_REPO_BASE_DIR" rm -rf $CERC_REPO_BASE_DIR mkdir -p $CERC_REPO_BASE_DIR $SO_COMMAND --stack ${stack_name} setup-repositories echo "Building containers" $SO_COMMAND --stack ${stack_name} build-containers test_deployment_dir=$CERC_REPO_BASE_DIR/test-deployment-dir test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml $SO_COMMAND --stack ${stack_name} deploy init --output $test_deployment_spec # Check the file now exists if [ ! -f "$test_deployment_spec" ]; then test_fail_exit "deploy init test: spec fille not present" fi echo "deploy init test: passed" $SO_COMMAND --stack ${stack_name} deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir # Check the deployment dir exists if [ ! -d "$test_deployment_dir" ]; then test_fail_exit "deploy create test: deployment directory not present" fi echo "deploy create test: passed" $SO_COMMAND deployment --dir $test_deployment_dir start sleep 30 $SO_COMMAND deployment --dir $test_deployment_dir stop echo "${test_name}: PASSED"