Skip to content

Commit

Permalink
Test that shows a problem, aka TDD
Browse files Browse the repository at this point in the history
  • Loading branch information
amnk committed Feb 4, 2021
1 parent 5822ccb commit f1d8ef0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/fixture-locals/run-once/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
foo = run_cmd("echo", "aaa")
}
16 changes: 16 additions & 0 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const (
TERRAFORM_STATE_BACKUP = "terraform.tfstate.backup"
TERRAGRUNT_CACHE = ".terragrunt-cache"
TERRAGRUNT_DEBUG_FILE = "terragrunt-debug.tfvars.json"
TEST_FIXTURE_LOCAL_RUN_ONCE = "fixture-locals/run-once"
)

func init() {
Expand Down Expand Up @@ -4031,3 +4032,18 @@ func TestTerragruntRunAllCommandPrompt(t *testing.T) {
assert.Contains(t, stderr.String(), "Are you sure you want to run 'terragrunt apply' in each folder of the stack described above? (y/n)")
assert.Error(t, err)
}

// See https://github.com/gruntwork-io/terragrunt/issues/1427
func TestTerragruntInitRunOnce(t *testing.T) {
t.Parallel()

cleanupTerraformFolder(t, TEST_FIXTURE_LOCAL_RUN_ONCE)
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}

runTerragruntCommand(t, fmt.Sprintf("terragrunt init --terragrunt-working-dir %s", TEST_FIXTURE_LOCAL_RUN_ONCE), &stdout, &stderr)

errout := string(stderr.Bytes())

assert.Equal(t, 1, strings.Count(errout, "aaa"))
}
2 changes: 1 addition & 1 deletion util/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const DEFAULT_LOG_LEVEL = logrus.WarnLevel
// Should be used in cases when more specific logger can't be created (like in the very beginning, when we have not yet
// parsed command line arguments).
//
// This might go away once we migrate toproper cli library
// This might go away once we migrate to proper cli library
// (see https://github.com/gruntwork-io/terragrunt/blob/master/cli/args.go#L29)
var GlobalFallbackLogEntry *logrus.Entry

Expand Down

0 comments on commit f1d8ef0

Please sign in to comment.