-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepend flags, append positional args (#11)
* Add tests * add debug info
- Loading branch information
Showing
7 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
all: | ||
bats --tap . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function setup() { | ||
export TF_CLI_INIT_FROM_MODULE="git::https://https://github.com/cloudposse/terraform-null-label?ref=master" | ||
export TF_CLI_INIT_BACKEND=false | ||
export TF_CLI_INIT="module/" | ||
export TF_ENV=${TF_ENV:-../release/tfenv} | ||
} | ||
|
||
function teardown() { | ||
unset TF_CLI_INIT_FROM_MODULE | ||
unset TF_CLI_INIT_BACKEND | ||
unset TF_CLI_INIT | ||
unset TF_ENV | ||
} | ||
|
||
@test "TF_CLI_ARGS_init works" { | ||
which ${TF_ENV} | ||
${TF_ENV} printenv TF_CLI_ARGS_init >&2 | ||
[ "$(${TF_ENV} printenv TF_CLI_ARGS_init)" != "" ] | ||
[ "$(${TF_ENV} printenv TF_CLI_ARGS_init)" == "-backend=${TF_CLI_INIT_BACKEND} -from-module=${TF_CLI_INIT_FROM_MODULE} ${TF_CLI_INIT}" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function setup() { | ||
export TF_CLI_PLAN_AUTO_APPROVE="true" | ||
export TF_CLI_PLAN_NO_COLOR="true" | ||
export TF_CLI_PLAN_OUT="plan.txt" | ||
export TF_CLI_PLAN="module/" | ||
export TF_ENV=${TF_ENV:-../release/tfenv} | ||
} | ||
|
||
function teardown() { | ||
unset TF_CLI_PLAN_AUTO_APPROVE | ||
unset TF_CLI_PLAN_NO_COLOR | ||
unset TF_CLI_PLAN_OUT | ||
unset TF_CLI_PLAN | ||
unset TF_ENV | ||
} | ||
|
||
@test "TF_CLI_ARGS_plan works" { | ||
which ${TF_ENV} | ||
${TF_ENV} printenv TF_CLI_ARGS_plan >&2 | ||
[ "$(${TF_ENV} printenv TF_CLI_ARGS_plan)" != "" ] | ||
[ "$(${TF_ENV} printenv TF_CLI_ARGS_plan)" == "-no-color -out=${TF_CLI_PLAN_OUT} -auto-approve $TF_CLI_PLAN" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function setup() { | ||
export FOOBAR=123 | ||
export Blah=true | ||
export _something=good | ||
export TF_ENV=${TF_ENV:-../release/tfenv} | ||
} | ||
|
||
function teardown() { | ||
unset FOOBAR | ||
unset Blah | ||
unset _something | ||
unset TF_ENV | ||
} | ||
|
||
@test "TF_VAR_foobar works" { | ||
which ${TF_ENV} | ||
${TF_ENV} printenv TF_VAR_foobar >&2 | ||
[ "$(${TF_ENV} printenv TF_VAR_foobar)" != "" ] | ||
[ "$(${TF_ENV} printenv TF_VAR_foobar)" == "${FOOBAR}" ] | ||
} | ||
|
||
@test "TF_VAR_blah works" { | ||
which ${TF_ENV} | ||
${TF_ENV} printenv TF_VAR_blah >&2 | ||
[ "$(${TF_ENV} printenv TF_VAR_blah)" != "" ] | ||
[ "$(${TF_ENV} printenv TF_VAR_blah)" == "${Blah}" ] | ||
} | ||
|
||
@test "TF_VAR_something works" { | ||
which ${TF_ENV} | ||
${TF_ENV} printenv TF_VAR_something >&2 | ||
[ "$(${TF_ENV} printenv TF_VAR_something)" != "" ] | ||
[ "$(${TF_ENV} printenv TF_VAR_something)" == "${_something}" ] | ||
} |