From 446b50597fb3ff1b0cb716c38ee13c85828d9c69 Mon Sep 17 00:00:00 2001 From: BuzzTroll Date: Mon, 16 Aug 2010 06:55:55 -0500 Subject: [PATCH] test framework changes --- tests/bt-nimbus.sh | 9 +++++---- tests/cc-list-test.py | 0 tests/cc1-test.sh | 2 ++ tests/install-nim.py | 11 +++++++++++ tests/make-test-env.sh | 19 +++++++++++++++++-- 5 files changed, 35 insertions(+), 6 deletions(-) mode change 100644 => 100755 tests/cc-list-test.py diff --git a/tests/bt-nimbus.sh b/tests/bt-nimbus.sh index ec281bd5..1422cb6f 100755 --- a/tests/bt-nimbus.sh +++ b/tests/bt-nimbus.sh @@ -1,16 +1,18 @@ #!/bin/bash work_dir=$1 +bkdate=`date +%s` function on_exit() { -# rm -rf $work_dir + echo "Cleaning up! $bkdate" + rm -rf $work_dir rm -rf ~/.nimbus rm -rf ~/.globus mv ~/.nimbus.$bkdate ~/.nimbus mv ~/.globus.$bkdate ~/.globus + mv ~/.ssh.$bkdate ~/.ssh } -bkdate=`date +%s` if [ "X$work_dir" == "X" ]; then work_dir=`mktemp --tmpdir=$HOME -d -t tmp.XXXXXXXXXX` mv ~/.ssh ~/.ssh.$bkdate @@ -52,10 +54,9 @@ cd $src_dir cnt="0" error_cnt="0" error_ts="" -touch test.log for t in *test.{sh,py} do - ./$t | tee -a test.log + ./$t 2>&1 | tee $t.log if [ $PIPESTATUS -ne 0 ]; then echo "$cnt parent tests passed (many more subtests were run)" echo "the test $t failed" diff --git a/tests/cc-list-test.py b/tests/cc-list-test.py old mode 100644 new mode 100755 diff --git a/tests/cc1-test.sh b/tests/cc1-test.sh index df68abe1..39a5d40a 100755 --- a/tests/cc1-test.sh +++ b/tests/cc1-test.sh @@ -1,5 +1,7 @@ #!/bin/bash +ls -l ~/.ssh/ + cd $CLOUD_CLIENT_HOME ./bin/grid-proxy-init.sh ./bin/cloud-client.sh --delete --name group diff --git a/tests/install-nim.py b/tests/install-nim.py index deec0759..3c507bcf 100644 --- a/tests/install-nim.py +++ b/tests/install-nim.py @@ -1,5 +1,7 @@ import pexpect import sys +from ConfigParser import SafeConfigParser + cmd = "%s %s" % (sys.argv[1], sys.argv[2]) logfile = sys.stdout @@ -12,3 +14,12 @@ child.sendline ('localhost') x = child.readlines() print x + +try: + print "setting up ssh knowhosts" + child = pexpect.spawn (cmd, timeout=8, maxread=20000, logfile=logfile) + child.expect ('(yes/no)?') + print child.before + child.sendline ('yes') +except: + pass diff --git a/tests/make-test-env.sh b/tests/make-test-env.sh index e0cd5620..47b31727 100755 --- a/tests/make-test-env.sh +++ b/tests/make-test-env.sh @@ -7,6 +7,21 @@ if [ "X$work_dir" == "X" ]; then exit 1 fi +if [ -e $HOME/.ssh ]; then + echo "this will destroy your .ssh dir! please back it up first" + exit 1 +fi +if [ -e $HOME/.globus ]; then + echo "this will destroy your .globus dir! please back it up first" + exit 1 +fi +if [ -e $HOME/.nimbus ]; then + echo "this will destroy your .nimbus dir! please back it up first" + exit 1 +fi + + + bd=`dirname $0` cd $bd src_dir=`pwd` @@ -38,13 +53,13 @@ echo "Configuring propagation only mode" echo "=========================================" cp -r $repo_dir/nimbus/control/ $work_dir -ssh-keygen -N "" -f $work_dir/keys +ssh-keygen -N "" -f ~/.ssh/id_rsa cp ~/.ssh/authorized_keys ~/.ssh/authorized_keys.back.$bkdate touch ~/.ssh/authorized_keys cat $work_dir/keys.pub >> ~/.ssh/authorized_keys user=`whoami` -sed -e "s^@KEY@^$work_dir/keys^" -e "s/@WHO@/$user/" $src_dir/autoconfig-decisions.sh.in > $install_dir/services/share/nimbus-autoconfig/autoconfig-decisions.sh +sed -e "s^@KEY@^$HOME/.ssh/id_rsa^" -e "s/@WHO@/$user/" $src_dir/autoconfig-decisions.sh.in > $install_dir/services/share/nimbus-autoconfig/autoconfig-decisions.sh cat $install_dir/services/share/nimbus-autoconfig/autoconfig-decisions.sh