Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Jan 7, 2022
1 parent 41693e2 commit 2306be5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 51 deletions.
3 changes: 0 additions & 3 deletions cmd/terramate/cli/cli_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down
35 changes: 7 additions & 28 deletions cmd/terramate/cli/cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down Expand Up @@ -409,44 +406,32 @@ func TestRunOrderNotChangedStackIgnored(t *testing.T) {
assertRunResult(t, cli.run("stacks", "list", "--changed"), runExpected{Stdout: wantList})

cat := test.LookPath(t, "cat")
wantRun := fmt.Sprintf(
"Running on changed stacks:\n[%s] running %s %s\n%s\n",
stack.RelPath(),
cat,
mainTfFileName,
mainTfContents,
)
wantRun := mainTfContents

assertRunResult(t, cli.run(
"run",
"--changed",
cat,
mainTfFileName,
), runExpected{Stdout: wantRun})
), runExpected{Stdout: wantRun, IgnoreStderr: true})

wantRun = fmt.Sprintf(
"Running on changed stacks:\n[%s] running %s %s\n%s\n",
".",
cat,
mainTfFileName,
mainTfContents,
)
wantRun = mainTfContents

cli = newCLI(t, stack.Path())
assertRunResult(t, cli.run(
"run",
"--changed",
cat,
mainTfFileName,
), runExpected{Stdout: wantRun})
), runExpected{Stdout: wantRun, IgnoreStderr: true})

cli = newCLI(t, stack2.Path())
assertRunResult(t, cli.run(
"run",
"--changed",
cat,
mainTfFileName,
), runExpected{Stdout: "Running on changed stacks:\n"})
), runExpected{Stdout: "", IgnoreStderr: true})
}

func TestRunOrderAllChangedStacksExecuted(t *testing.T) {
Expand Down Expand Up @@ -486,14 +471,8 @@ func TestRunOrderAllChangedStacksExecuted(t *testing.T) {

cat := test.LookPath(t, "cat")
wantRun := fmt.Sprintf(
"Running on changed stacks:\n[%s] running %s %s\n%s\n[%s] running %s %s\n%s\n",
stack2.RelPath(),
cat,
mainTfFileName,
"%s%s",
mainTfContents,
stack.RelPath(),
cat,
mainTfFileName,
mainTfContents,
)

Expand All @@ -502,5 +481,5 @@ func TestRunOrderAllChangedStacksExecuted(t *testing.T) {
"--changed",
cat,
mainTfFileName,
), runExpected{Stdout: wantRun})
), runExpected{Stdout: wantRun, IgnoreStderr: true})
}
3 changes: 0 additions & 3 deletions cmd/terramate/cli/cli_stacks_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down
3 changes: 0 additions & 3 deletions cmd/terramate/cli/cli_stacks_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down
13 changes: 2 additions & 11 deletions cmd/terramate/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down Expand Up @@ -157,20 +154,14 @@ func TestListAndRunChangedStack(t *testing.T) {
assertRunResult(t, cli.run("stacks", "list", "--changed"), runExpected{Stdout: wantList})

cat := test.LookPath(t, "cat")
wantRun := fmt.Sprintf(
"Running on changed stacks:\n[%s] running %s %s\n%s\n",
stack.RelPath(),
cat,
mainTfFileName,
mainTfContents,
)
wantRun := mainTfContents

assertRunResult(t, cli.run(
"run",
"--changed",
cat,
mainTfFileName,
), runExpected{Stdout: wantRun})
), runExpected{Stdout: wantRun, IgnoreStderr: true})
}

func TestListAndRunChangedStackInAbsolutePath(t *testing.T) {
Expand Down
3 changes: 0 additions & 3 deletions cmd/terramate/cli/stacks_globals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// FIXME(katcipis): improve CLI tests isolation
//go:build ignore

package cli_test

import (
Expand Down

0 comments on commit 2306be5

Please sign in to comment.