From 3dffab658fa7cd065a2f1122dc533b8c1a163e0b Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Thu, 2 Dec 2010 13:08:08 -0800 Subject: [PATCH] Update test script to enable testing ssl [#104 state:resolved tagged:@needsdocumentation] --- test/test.sh | 13 ++++++++++++- test/testweb.sh | 12 ++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/test/test.sh b/test/test.sh index be75b195f0b..e8cfa9f656b 100755 --- a/test/test.sh +++ b/test/test.sh @@ -72,7 +72,18 @@ fi rm $DIR/exec.out -sh $DIR/testweb.sh +egrep 'https://' $RDECK_BASE/etc/framework.properties > /dev/null +if [ 0 = $? ] ; then + # call testweb and use -k curl option to ignore server certificate + sh $DIR/testweb.sh "https://localhost:4443" -k + ################# + # alternate args to curl to use a pem formatted cert to verify server cert: + #sh $DIR/testweb.sh "https://localhost:4443" "--cacert $RDECK_BASE/etc/rundeck.server.pem" + ################ +else + sh $DIR/testweb.sh "http://localhost:4440" +fi + if [ 0 != $? ] ; then echo Failed to run testweb.sh : $! exit 2 diff --git a/test/testweb.sh b/test/testweb.sh index 10e1fe02dfc..965897daa90 100755 --- a/test/testweb.sh +++ b/test/testweb.sh @@ -15,13 +15,17 @@ fi # test log in -url='http://localhost:4440' +url=$1 +if [ -z "$url" ] ; then + url='http://localhost:4440' +fi loginurl="${url}/j_security_check" +curlopts=$2 # get main page for login echo "WEB Starting tests." echo "WEB Trying login..." -curl -s -S -L -c $DIR/cookies ${url}/menu/index > $DIR/curl.out +curl $curlopts -s -S -L -c $DIR/cookies ${url}/menu/index > $DIR/curl.out if [ 0 != $? ] ; then errorMsg "failed menu request to ${url}/menu/index" exit 2 @@ -34,7 +38,7 @@ if [ 0 != $? ] ; then fi -curl -s -S -L -c $DIR/cookies -b $DIR/cookies -d j_username=admin -d j_password=admin $loginurl > $DIR/curl.out +curl $curlopts -s -S -L -c $DIR/cookies -b $DIR/cookies -d j_username=admin -d j_password=admin $loginurl > $DIR/curl.out if [ 0 != $? ] ; then errorMsg "failed login request to ${loginurl}" exit 2 @@ -55,7 +59,7 @@ fi echo "WEB Login OK" echo "WEB Testing Nodes..." # get nodes page -curl -s -S -L -c $DIR/cookies -b $DIR/cookies ${url}/resources/nodes?project=test > $DIR/curl.out +curl $curlopts -s -S -L -c $DIR/cookies -b $DIR/cookies ${url}/resources/nodes?project=test > $DIR/curl.out if [ 0 != $? ] ; then errorMsg "failed nodes request" exit 2