Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 594ce0e

Browse files
author
Ian Campbell
committed
e2e: Use subtests in render test.
Separate the "file" and "stdio" case since they both error with "rendering mismatch". Signed-off-by: Ian Campbell <[email protected]>
1 parent eca2252 commit 594ce0e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

e2e/commands_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,15 @@ func testRenderApp(appPath string, env ...string) func(*testing.T) {
6666
}
6767
cmd.Command = args
6868
cmd.Env = append(cmd.Env, env...)
69-
// Check rendering to stdout
70-
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
71-
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), result.Stdout()), "rendering mismatch")
72-
// Checks rendering to a file
73-
cmd.Command = append(cmd.Command, "--output="+dir.Join("actual.yaml"))
74-
icmd.RunCmd(cmd).Assert(t, icmd.Success)
75-
76-
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), readFile(t, dir.Join("actual.yaml"))), "rendering mismatch")
69+
t.Run("stdout", func(t *testing.T) {
70+
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
71+
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), result.Stdout()), "rendering mismatch")
72+
})
73+
t.Run("file", func(t *testing.T) {
74+
cmd.Command = append(cmd.Command, "--output="+dir.Join("actual.yaml"))
75+
icmd.RunCmd(cmd).Assert(t, icmd.Success)
76+
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), readFile(t, dir.Join("actual.yaml"))), "rendering mismatch")
77+
})
7778
}
7879
}
7980

0 commit comments

Comments
 (0)