forked from Azure/terraform-azurerm-postgresql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
35 lines (30 loc) · 647 Bytes
/
test.sh
File metadata and controls
35 lines (30 loc) · 647 Bytes
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
#! /bin/bash
if [ $# != 1 ] || [ $1 != "validate" -a $1 != "full" ]; then
echo "Please pass 'validate' or 'full' parameter."
exit 1
fi
run_command()
{
echo "Running: $1"
$1
if [ $? != 0 ]; then
echo "Failed: $1"
exit 1
else
echo "Passed: $1"
fi
}
COMMANDS=()
if [ $1 == "validate" ] || [ $1 == "full" ]
then
COMMANDS+=("terraform fmt -check=true")
COMMANDS+=("terraform validate -check-variables=false")
COMMANDS+=("dep ensure")
fi
if [ $1 == "full" ]; then
COMMANDS+=("go test -v ./test/ -timeout 20m")
fi
for command in "${COMMANDS[@]}"
do
run_command "$command"
done