1
1
#! /bin/bash
2
2
3
- # Stop execution if any command has errors
3
+ # Usage:
4
+ # To check if new changes to the layer cause changes to any snapshots:
5
+ # BUILD_LAYERS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests
6
+ # To regenerate snapshots:
7
+ # UPDATE_SNAPSHOTS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests
8
+
4
9
set -e
5
10
6
11
# These values need to be in sync with serverless.yml, where there needs to be a function
@@ -21,15 +26,15 @@ mismatch_found=false
21
26
22
27
echo " Start time is $script_start_time "
23
28
24
- if [ -n " $UPDATE_SNAPSHOTS " ]; then
25
- echo " Overwriting snapshots in this execution"
26
- fi
27
-
28
29
if [ -z " $DD_API_KEY " ]; then
29
30
echo " No DD_API_KEY env var set, exiting"
30
31
exit 1
31
32
fi
32
33
34
+ if [ -n " $UPDATE_SNAPSHOTS " ]; then
35
+ echo " Overwriting snapshots in this execution"
36
+ fi
37
+
33
38
if [ -n " $BUILD_LAYERS " ]; then
34
39
echo " Building layers that will be deployed with our test functions"
35
40
source $scripts_dir /build_layers.sh
@@ -42,7 +47,7 @@ cd $integration_tests_dir
42
47
serverless deploy
43
48
44
49
echo " Invoking functions"
45
- set +e # Don't exit this script if an invocation fails
50
+ set +e # Don't immediately exit this script if an invocation fails or there's a diff
46
51
for handler_name in " ${LAMBDA_HANDLERS[@]} " ; do
47
52
for runtime in " ${RUNTIMES[@]} " ; do
48
53
function_name=" $handler_name -$runtime "
@@ -52,6 +57,7 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
52
57
53
58
if [ -n " $UPDATE_SNAPSHOTS " ] || [ ! -f $function_snapshot_path ]; then
54
59
# If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot
60
+ # If the snapshot file doesn't exist yet, we create it
55
61
echo " Writing return value snapshot for $function_name "
56
62
echo " $return_value " > $function_snapshot_path
57
63
else
@@ -67,7 +73,6 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
67
73
fi
68
74
done
69
75
done
70
-
71
76
set -e
72
77
73
78
echo " Sleeping $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..."
0 commit comments