summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-04-09 13:58:44 -0400
committerMicah Anderson <micah@riseup.net>2015-04-09 13:58:44 -0400
commitb29ef8c4b92f0f97f6531474334a0a454f6fc773 (patch)
tree1d5dcd25478dbf0ed418262efc7e3cbc26a2c467
parent10a6a3eb5fd6b66b1b55d6d65e910a9c9a8fa7b6 (diff)
add an init_deploy, and reformat reset_deploy
-rwxr-xr-xleap-platform-test168
1 files changed, 130 insertions, 38 deletions
diff --git a/leap-platform-test b/leap-platform-test
index a2723ef..e1bc4f1 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -25,6 +25,7 @@ COMMANDS
- leap local save
create_provider creates a provider instance
deploy <node(s)> deploy node(s)
+ init_deploy <node(s)> initialize node, then do a deploy
destroy_deploy <node(s)> destroy vms, init, and deploy
reset_deploy <node(s)> reset and deploy node(s)
test <node(s)> run leap test
@@ -165,7 +166,6 @@ log_start() {
echo "Starting $0 on $( date )"
}
-
deploy_failure_email() {
versions=$( versions )
if [ -s "$ERRLOG1" ]
@@ -199,7 +199,6 @@ deploy_failure_email() {
sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}"
fi
}
-reset_deploy() {
test_failure_email() {
test_failure=$?
@@ -221,55 +220,147 @@ test_failure_email() {
sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" -a "$TEST_LOG2"
}
- echo "Starting deploy_nodes for nodes $@ as background tasks on $( date )"
+init_deploy() {
+ # init_deploy tests that a re-init of a node, then a deploy works this
+ # accepts that the limited tagged deploy that happens in bootstrap_nodes()
+ # is ok. The following steps happen:
+ #
+ #. make sure the platform and leap cli are up-to-date
+ #. reset the nodes to their saved state (saved is after bootstrap_nodes has
+ # been run)
+ #. run bootstrap_nodes (this will: start vm, run init, run a limited tag
+ # deploy, then reset the node)
+ #. deploy the nodes
+ #. run tests
+ #. send email
- for i in $nodes
- do
- $LEAP_CMD $OPTS local reset "$i"
- wait_for_node "$i"
- deploy "$i" &
- done
+ check_for_running_instances || exit $?
- # needed in a detached screen session, otherwise it would terminate before deploy jobs
- # have finished
- echo "Waiting for last deploy process has finished..."
- wait
+ local nodes="$*"
+ update_platform
+ update_leap_cli
-
- if [ ! -e "$deploy_failure" -a -n "$MAIL_TO" ]
- then
- versions=$( versions )
- subj="OK - \"leap deploy\" of platform $PLATFORM_BRANCH branch went fine."
- msg="Tested on $( date ) on these nodes: \"$nodes\"\nwith following versions/git commit IDs: \n\n$versions"
+ cd "$PROVIDERDIR"
- echo "Sending deploy success mail to $MAIL_TO"
- sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}"
- fi
+ log_start
- run_tests
- test_failure=$?
+ echo "Starting init_deploy for nodes $@ as background tasks on $( date )"
- versions=$( versions )
- msg="Tested on $( date ) on these nodes: \"$nodes\"\nwith following versions/git commit IDs: \n\n$versions"
- if [ $test_failure -eq 0 ]
- then
- subj="OK - \"leap test\" of platform $PLATFORM_BRANCH branch is all green."
- else
- subj="WARNING - \"leap test\" of platform $PLATFORM_BRANCH branch failed !!"
- fi
+ for i in $nodes
+ do
+ $LEAP_CMD $OPTS local reset "$i"
+ wait_for_node "$i"
+ bootstrap_nodes "$i"
+ deploy "$i" &
+ done
- echo "$subj"
+ # needed in a detached screen session, otherwise it would terminate before deploy jobs
+ # have finished
+ echo "Waiting until last deploy process has finished..."
+ wait
- echo "Sending test mail to $MAIL_TO"
- # unfortunatly, no tls atm, fixed in sendemail 1.56-3
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679911
- sendemail -f "$MAIL_FROM" -t "$MAIL_TO" -o tls=no -m "${msg}" -u "${subj}" -a "$TEST_LOG2"
+ # send mail if deployment fails
+ deploy_failure_email
+ # run tests
+ run_tests
+
+ # send mail if tests fail
+ test_failure_email
+}
+
+reset_deploy() {
+ # reset_deploy tests that a deploy works after the node has been reset to
+ # the bootstrap_nodes() state it does not re-run bootstrap_nodes(), so a
+ # 'leap node init' is not run again, this is usually sufficient. The
+ # following steps happen:
+ #
+ #. make sure the platform and leap cli are up-to-date
+ #. reset the nodes to their saved state (saved is after bootstrap_nodes has
+ # been run)
+ #. deploy the nodes
+ #. run tests
+ #. send email
+
+ check_for_running_instances || exit $?
+
+ local nodes="$*"
+ update_platform
+ update_leap_cli
+
+ cd "$PROVIDERDIR"
+
+ log_start
+
+ echo "Starting reset_deploy for nodes $@ as background tasks on $( date )"
+
+ for i in $nodes
+ do
+ $LEAP_CMD $OPTS local reset "$i"
+ wait_for_node "$i"
+ deploy "$i" &
+ done
+
+ # needed in a detached screen session, otherwise it would terminate before deploy jobs
+ # have finished
+ echo "Waiting until last deploy process has finished..."
+ wait
+
+ # send mail if deployment fails
+ deploy_failure_email
+
+ # run tests
+ run_tests
+
+ # send mail if tests fail
+ test_failure_email
}
destroy_deploy() {
+ # destroy_deploy tests a full-cycle, it destroys the VMs, re-creates them
+ # from scratch and then bootstraps them. The following steps happen:
+ #. make sure the platform and leap cli are up-to-date
+ #. destroy the vms
+ #. run bootstrap_nodes (this will: start vm, run init, run a limited tag
+ # deploy, then reset the node)
+ #. deploy the nodes
+ #. run tests
+ #. send email
+
+ check_for_running_instances || exit $?
+
+ local nodes="$*"
+ update_platform
+ update_leap_cli
+
+ cd "$PROVIDERDIR"
+
+ log_start
+
+ echo "Starting destroy_deploy for nodes $@ as background tasks on $( date )"
+
destroy_vms "$@"
- bootstrap_nodes "$@"
+
+ for i in $nodes
+ do
+ bootstrap_nodes "$i"
+ deploy "$i" &
+ done
+
+ # needed in a detached screen session, otherwise it would terminate before deploy jobs
+ # have finished
+ echo "Waiting until last deploy process has finished..."
+ wait
+
+ # send mail if deployment fails
+ deploy_failure_email
+
+ # run tests
+ run_tests
+
+ # send mail if tests fail
+ test_failure_email
+
}
ssh_up () {
@@ -444,6 +535,7 @@ case $cmd in
create_provider) create_provider;;
deploy) deploy "$nodes";;
destroy_deploy) destroy_deploy "$nodes";;
+ init_deploy) init_deploy "$nodes";;
reset_deploy) reset_deploy "$nodes";;
test) run_tests "$nodes";;
(*) usage; echo "Please specify a command."; exit 1;;