Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up test scripts with common include
- Loading branch information
Showing
31 changed files
with
125 additions
and
682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# common header for test scripts | ||
|
||
DIR=$(cd `dirname $0` && pwd) | ||
|
||
errorMsg() { | ||
echo "$*" 1>&2 | ||
} | ||
assert(){ | ||
# assert expected, actual | ||
if [ "$1" != "$2" ] ; then | ||
errorMsg "FAIL: Expected value \"$1\" but saw: \"$2\" ${3}" | ||
exit 2 | ||
fi | ||
} | ||
|
||
# modify to point to xmlstarlet | ||
XMLSTARLET=xml | ||
|
||
# xmlstarlet select xpath | ||
# usage: xmlsel XPATH file | ||
xmlsel(){ | ||
$XMLSTARLET sel -T -t -v "$1" $2 | ||
} | ||
|
||
VERSHEADER="X-RUNDECK-API-VERSION: 1.2" | ||
|
||
# curl opts to use a cookie jar, and follow redirects, showing only errors | ||
CURLOPTS="-s -S -L -c $DIR/cookies -b $DIR/cookies" | ||
CURL="curl $CURLOPTS" | ||
|
||
# accept url argument on commandline, if '-' use default | ||
RDURL="$1" | ||
if [ "-" == "$1" ] ; then | ||
RDURL='http://localhost:4440' | ||
fi | ||
shift | ||
|
||
APIURL="${RDURL}/api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.