summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2014-08-26 12:15:12 +0000
committervarac <varacanero@zeromail.org>2014-08-26 12:18:04 +0000
commit051b570f03b1ddc02532a0d7074319b7bad64b2f (patch)
tree50422afa1c6cb1dd6b3c942e32fcb6e5ca126aa7
parent351363f7d9da8c524fa0138cae5be3ad55f04285 (diff)
integrate run_tests into reset_deploy
-rwxr-xr-xleap-platform-test44
1 files changed, 32 insertions, 12 deletions
diff --git a/leap-platform-test b/leap-platform-test
index 1b1f131..ac707ed 100755
--- a/leap-platform-test
+++ b/leap-platform-test
@@ -121,7 +121,7 @@ deploy() {
then
touch $deploy_failure
versions=`versions`
- msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: leap_platform $PLATFORM_BRANCH branch on \"$vm\" had errors !\n\n"
+ msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: WARNING - \"leap deploy\" of platform $PLATFORM_BRANCH branch on \"$vm\" had errors !\n\n"
echo "`date`: $msg" | tee -a $LOG1 $LOG2 $ERRLOG2
echo
msg="${msg} Output of error log below:\n\n`cat $ERRLOG1` \n\n"
@@ -188,13 +188,32 @@ reset_deploy() {
if [ ! -e $deploy_failure -a -n $MAIL_TO ]
then
versions=`versions`
- msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: Success ! leap_platform $PLATFORM_BRANCH branch deployed fine\n\n"
+ msg="From: $MAIL_FROM\nTo: $MAIL_TO\nSubject: OK - \"leap deploy\" of platform $PLATFORM_BRANCH branch went fine.\n\n"
msg="${msg}Tested on `date` on these nodes: \"$nodes\"\nwith following versions/git commit IDs: \n\n$versions"
- echo "Sending success mail to $MAIL_TO"
+ echo "Sending deploy success mail to $MAIL_TO"
printf "$msg" | /usr/sbin/sendmail -t
fi
+ run_tests
+ test_failure=$?
+
+ 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
+
+ echo $subj
+
+ 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
+
}
ssh_up () {
@@ -208,16 +227,15 @@ run_tests () {
TEST_FILTER='net.ssh.authentication.agent.*could not connect to ssh-agent'
- echo -e "\nRunning leap test on `date`" | tee -a $LOG1 $LOG2
- $LEAP_CMD $OPTS test 2>&1 | egrep -v "$TEST_FILTER" | tee -a $LOG1 $LOG2
- #$LEAP_CMD $OPTS test 2>&1
- test_failure=$?
+ echo -e "\nRunning leap test on `date`" | tee -a $TEST_LOG1 $TEST_LOG2
+ $LEAP_CMD $OPTS test 2>&1 | egrep -v "$TEST_FILTER" | tee -a $TEST_LOG1 $TEST_LOG2
+ test_failure=${PIPESTATUS[0]}
- if [ $? -ne 0 ]
+ if [ $test_failure -ne 0 ]
then
- echo 'WARNING - "leap test" failed !' | tee -a $LOG1 $LOG2
+ echo 'WARNING - "leap test" failed !' | tee -a $TEST_LOG1 $TEST_LOG2
else
- echo 'OK - "leap test" is all green !' | tee -a $LOG1 $LOG2
+ echo 'OK - "leap test" is all green !' | tee -a $TEST_LOG1 $TEST_LOG2
fi
return $test_failure
@@ -322,8 +340,6 @@ done
cmd=$1
shift
nodelist=$@
-TEST_LOG1="$LOGDIR/test.log"
-TEST_LOG2="$LOGDIR/test-$date.log"
#echo "config: $config"
#echo "cmd: $cmd"
@@ -342,6 +358,10 @@ source $config
# common config for all providers
source /etc/leap/platform-test-common.cfg
+date=`date +"%F-%H%M%S"`
+
+TEST_LOG1="$LOGDIR/test.log"
+TEST_LOG2="$LOGDIR/test-$date.log"
[ -e $PROVIDERDIR ] && cd $PROVIDERDIR