-
Notifications
You must be signed in to change notification settings - Fork 899
/
test-execution.sh
executable file
·65 lines (42 loc) · 1.18 KB
/
test-execution.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#test output from /api/execution/{id}
DIR=$(cd `dirname $0` && pwd)
source $DIR/include.sh
####
# Setup: create simple adhoc command execution to provide execution ID.
####
runurl="${APIURL}/run/command"
proj="test"
params="project=${proj}&exec=echo+testing+execution+api"
# get listing
$CURL --header "$VERSHEADER" ${runurl}?${params} > $DIR/curl.out
if [ 0 != $? ] ; then
errorMsg "ERROR: failed query request"
exit 2
fi
sh $DIR/api-test-success.sh $DIR/curl.out || exit 2
#select id
execid=$($XMLSTARLET sel -T -t -v "/result/execution/@id" $DIR/curl.out)
if [ -z "$execid" ] ; then
errorMsg "FAIL: expected execution id"
exit 2
fi
####
# Test:
####
# now submit req
runurl="${APIURL}/execution/${execid}"
echo "TEST: /api/execution/${execid} ..."
params=""
# get listing
$CURL --header "$VERSHEADER" ${runurl}?${params} > $DIR/curl.out
if [ 0 != $? ] ; then
errorMsg "ERROR: failed query request"
exit 2
fi
sh $DIR/api-test-success.sh $DIR/curl.out || exit 2
#Check projects list
itemcount=$($XMLSTARLET sel -T -t -v "/result/executions/@count" $DIR/curl.out)
assert "1" "$itemcount" "execution count should be 1"
echo "OK"
#rm $DIR/curl.out