Skip to content

Commit

Permalink
test: add testcase to reproduce bug fixed on #149 (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
i4ki authored Jan 11, 2022
1 parent 56be4c2 commit 765ce01
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions cmd/terramate/cli/cli_stacks_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,35 @@ terramate {
}
assertRunResult(t, cli.run("stacks", "list", "--changed"), want)
}

func TestListTwiceBug(t *testing.T) {
const (
mainTfFileName = "main.tf"
modname = "modA"
)

s := sandbox.New(t)

stack := s.CreateStack("stack")
mod1 := s.CreateModule(modname)
mod1MainTf := mod1.CreateFile(mainTfFileName, "# module A")

stack.CreateFile("main.tf", `
module "mod1" {
source = "%s"
}`, stack.ModSource(mod1))

git := s.Git()
git.CommitAll("first commit")
git.Push("main")
git.CheckoutNew("change-stack")

mod1MainTf.Write("# something else")
stack.CreateFile("test.txt", "something else")
git.CommitAll("stack and module changed")

cli := newCLI(t, s.RootDir())

wantList := stack.RelPath() + "\n"
assertRunResult(t, cli.run("stacks", "list", "--changed"), runExpected{Stdout: wantList})
}

0 comments on commit 765ce01

Please sign in to comment.