2023-04-20 22:26:19 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2023-04-20 22:58:13 +00:00
|
|
|
# Dump environment variables for debugging
|
|
|
|
echo "Environment variables:"
|
|
|
|
env
|
2023-01-10 17:24:04 +00:00
|
|
|
# Basic simple test of stack-orchestrator functionality
|
|
|
|
echo "Running stack-orchestrator smoke test"
|
2023-01-10 21:32:12 +00:00
|
|
|
# Bit of a hack, test the most recent package
|
|
|
|
TEST_TARGET_SO=$( ls -t1 ./package/laconic-so* | head -1 )
|
2023-01-10 17:24:04 +00:00
|
|
|
# Set a non-default repo dir
|
|
|
|
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
|
|
|
|
echo "Testing this package: $TEST_TARGET_SO"
|
2023-01-10 21:32:12 +00:00
|
|
|
echo "Test version command"
|
|
|
|
reported_version_string=$( $TEST_TARGET_SO version )
|
|
|
|
echo "Version reported is: ${reported_version_string}"
|
2023-01-10 17:24:04 +00:00
|
|
|
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
|
|
|
|
rm -rf $CERC_REPO_BASE_DIR
|
|
|
|
mkdir -p $CERC_REPO_BASE_DIR
|
|
|
|
# Pull an example small public repo to test we can pull a repo
|
|
|
|
$TEST_TARGET_SO setup-repositories --include cerc-io/laconic-sdk
|
2023-01-24 15:19:24 +00:00
|
|
|
# Test pulling a stack
|
|
|
|
$TEST_TARGET_SO --stack test setup-repositories
|
|
|
|
# Test building the a stack container
|
|
|
|
$TEST_TARGET_SO --stack test build-containers
|
|
|
|
# Build one example containers
|
|
|
|
$TEST_TARGET_SO build-containers --include cerc/builder-js
|
2023-04-20 22:47:40 +00:00
|
|
|
echo "Images in the local registry:"
|
2023-04-20 22:58:13 +00:00
|
|
|
docker image ls -a
|
2023-01-10 17:24:04 +00:00
|
|
|
# Deploy the test container
|
2023-01-24 15:19:24 +00:00
|
|
|
$TEST_TARGET_SO --stack test deploy-system up
|
2023-01-10 17:24:04 +00:00
|
|
|
# TODO: test that we can use the deployed container somehow
|
|
|
|
# Clean up
|
2023-01-24 15:19:24 +00:00
|
|
|
$TEST_TARGET_SO --stack test deploy-system down
|
2023-03-09 15:30:18 +00:00
|
|
|
# Run same test but not using the stack definition
|
|
|
|
# Test building the a stack container
|
|
|
|
$TEST_TARGET_SO build-containers --include cerc/test-container
|
2023-01-10 17:24:48 +00:00
|
|
|
echo "Test passed"
|