testing!
This commit is contained in:
parent
46ca0003af
commit
943ed79641
68
templates/test_template.sh
Executable file
68
templates/test_template.sh
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# default config should always work for localhost
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
|
TEMPLATE="$1"
|
||||||
|
|
||||||
|
function die() {
|
||||||
|
echo "$1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function title() {
|
||||||
|
echo "----------------------------------------"
|
||||||
|
echo "$1"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -d "$SCRIPT_DIR/$TEMPLATE" ]; then
|
||||||
|
echo "Local Template $TEMPLATE does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# for now, we need to build and locally install to test the template. Check if it's up to date.
|
||||||
|
|
||||||
|
|
||||||
|
HASH1=$(ds hash "$SCRIPT_DIR/$TEMPLATE")
|
||||||
|
HASH2=$(ds hash "/opt/dropshell/templates/$TEMPLATE")
|
||||||
|
|
||||||
|
if [ "$HASH1" != "$HASH2" ]; then
|
||||||
|
echo "Template $TEMPLATE is out of date"
|
||||||
|
echo "Need to run build.sh, and install locally."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SERVICE_NAME="test-$TEMPLATE"
|
||||||
|
|
||||||
|
title "Creating service"
|
||||||
|
ds create-service localhost $TEMPLATE $SERVICE_NAME || die "Failed to create service"
|
||||||
|
|
||||||
|
title "Installing service"
|
||||||
|
ds install localhost $SERVICE_NAME || die "Failed to install service"
|
||||||
|
|
||||||
|
title "Stopping service"
|
||||||
|
ds stop localhost $SERVICE_NAME || die "Failed to stop service"
|
||||||
|
|
||||||
|
title "Starting service"
|
||||||
|
ds start localhost $SERVICE_NAME || die "Failed to start service"
|
||||||
|
|
||||||
|
title "Listing services"
|
||||||
|
ds list localhost || die "Failed to list services"
|
||||||
|
|
||||||
|
title "Backing up service"
|
||||||
|
ds backup localhost $SERVICE_NAME || die "Failed to backup service"
|
||||||
|
|
||||||
|
title "Restoring service"
|
||||||
|
ds restore localhost $SERVICE_NAME || die "Failed to restore service"
|
||||||
|
|
||||||
|
title "Checking status"
|
||||||
|
ds status localhost $SERVICE_NAME || die "Failed to check status"
|
||||||
|
|
||||||
|
title "Nuking service"
|
||||||
|
ds nuke localhost $SERVICE_NAME || die "Failed to nuke service"
|
||||||
|
|
||||||
|
title "Listing services"
|
||||||
|
ds list localhost || die "Failed to list services"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user