10000 Readability tweaks for shell script · DataDog/datadog-lambda-python@583bd56 · GitHub
[go: up one dir, main page]

Skip to content

Commit 583bd56

Browse files
committed
Readability tweaks for shell script
1 parent 7b900f0 commit 583bd56

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

scripts/run_integration_tests.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22

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+
49
set -e
510

611
# These values need to be in sync with serverless.yml, where there needs to be a function
@@ -21,15 +26,15 @@ mismatch_found=false
2126

2227
echo "Start time is $script_start_time"
2328

24-
if [ -n "$UPDATE_SNAPSHOTS" ]; then
25-
echo "Overwriting snapshots in this execution"
26-
fi
27-
2829
if [ -z "$DD_API_KEY" ]; then
2930
echo "No DD_API_KEY env var set, exiting"
3031
exit 1
3132
fi
3233

34+
if [ -n "$UPDATE_SNAPSHOTS" ]; then
35+
echo "Overwriting snapshots in this execution"
36+
fi
37+
3338
if [ -n "$BUILD_LAYERS" ]; then
3439
echo "Building layers that will be deployed with our test functions"
3540
source $scripts_dir/build_layers.sh
@@ -42,7 +47,7 @@ cd $integration_tests_dir
4247
serverless deploy
4348

4449
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
4651
for handler_name in "${LAMBDA_HANDLERS[@]}"; do
4752
for runtime in "${RUNTIMES[@]}"; do
4853
function_name="$handler_name-$runtime"
@@ -52,6 +57,7 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
5257

5358
if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then
5459
# 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
5561
echo "Writing return value snapshot for $function_name"
5662
echo "$return_value" >$function_snapshot_path
5763
else
@@ -67,7 +73,6 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
6773
fi
6874
done
6975
done
70-
7176
set -e
7277

7378
echo "Sleeping $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..."

0 commit comments

Comments
 (0)
0