-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest.sh
executable file
·72 lines (52 loc) · 851 Bytes
/
test.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
65
66
67
68
69
70
71
72
#!/bin/bash
# test lambdabash function in aws
# author: @jacobbaloul
#
#
function check_error(){
if test $? -gt 0 ; then
echo "oops! something went wrong, aborting."
exit 1
fi
}
#
##
## BEGIN
##
source settings.conf
check_error
if [ "$1" = '' ]
then
export CNT=10 # default to 10 loops for the test
else
export CNT=$1
fi
# BEGIN
export CURRENTCNT=1
seq 1 $CNT | while read cnt
do
echo " == Test #$CURRENTCNT: =="
# run the test
echo "
testing new lambda function by invoking...
"
aws lambda invoke \
--invocation-type RequestResponse \
--function-name lambdabash \
--region $REGION \
--log-type Tail \
--payload file://input.txt \
--profile $PROFILE \
--output json \
outputfile.txt
cat outputfile.txt
# increment current count
export CURRENTCNT=$[$CURRENTCNT+1]
done
echo "
=====
executed $CNT tests.
DONE
=====
"
# END