From 34beaaabe42912e170b08ef688ee129c2c37312f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Sm=C3=B3=C5=82ka?= Date: Thu, 7 Feb 2019 09:30:47 +0100 Subject: [PATCH] Move checking aws cli to separate function --- test/provisioner_file.bats | 1 + test/provisioner_shell.bats | 1 + test/test_helper.bash | 16 +++++++++------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/provisioner_file.bats b/test/provisioner_file.bats index 5800d2d82..3c8469897 100755 --- a/test/provisioner_file.bats +++ b/test/provisioner_file.bats @@ -5,6 +5,7 @@ # be sure any test cases set this. load test_helper +verify_aws_cli fixtures provisioner-file setup() { diff --git a/test/provisioner_shell.bats b/test/provisioner_shell.bats index 2986a4a16..016c209b0 100755 --- a/test/provisioner_shell.bats +++ b/test/provisioner_shell.bats @@ -5,6 +5,7 @@ # be sure any test cases set this. load test_helper +verify_aws_cli fixtures provisioner-shell setup() { diff --git a/test/test_helper.bash b/test/test_helper.bash index 43d30e429..a9dbc38eb 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -1,11 +1,13 @@ # Let's verify that the tools we need are installed -declare -a required=(aws) -for cmd in "${required[@]}"; do - command -v $cmd >/dev/null 2>&1 || { - echo "'$cmd' must be installed" >&2 - exit 1 - } -done +verify_aws_cli() { + declare -a required=(aws) + for cmd in "${required[@]}"; do + command -v $cmd >/dev/null 2>&1 || { + echo "'$cmd' must be installed" >&2 + exit 1 + } + done +} #-------------------------------------------------------------------- # Bats modification