forked from aws-samples/amazon-rds-init-cdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsmoke-test.sh
More file actions
executable file
·26 lines (21 loc) · 1.06 KB
/
smoke-test.sh
File metadata and controls
executable file
·26 lines (21 loc) · 1.06 KB
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
# simple smoke test: runs two queries using the lambda that should be deployed
# which connects to the database
# it fails if the lambda cannot be called, or the database is not accessible/the tables are not available
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "show tables", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output1
echo "show tables:"
cat output1
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "select Author from Books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output2
echo "select Author from Books:"
cat output2
return_status1=$(cat output1 | jq -r .status)
if [ "SUCCESS" != ${return_status1} ]; then
echo "unexpected response for query1: ${return_status1}"
cat output1
exit 1
fi
return_status2=$(cat output2 | jq -r .status)
if [ "SUCCESS" != ${return_status2} ]; then
echo "unexpected response for query2: ${return_status2}"
cat output2
exit 1
fi