Skip to content

Commit

Permalink
e2e: Use subtests in render test.
Browse files Browse the repository at this point in the history
Separate the "file" and "stdio" case since they both error with "rendering
mismatch".

Signed-off-by: Ian Campbell <ijc@docker.com>
  • Loading branch information
Ian Campbell committed May 13, 2019
1 parent fa5b577 commit 39fdf4a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions e2e/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ func testRenderApp(appPath string, env ...string) func(*testing.T) {
}
cmd.Command = args
cmd.Env = append(cmd.Env, env...)
// Check rendering to stdout
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), result.Stdout()), "rendering mismatch")
// Checks rendering to a file
cmd.Command = append(cmd.Command, "--output="+dir.Join("actual.yaml"))
icmd.RunCmd(cmd).Assert(t, icmd.Success)

assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), readFile(t, dir.Join("actual.yaml"))), "rendering mismatch")
t.Run("stdout", func(t *testing.T) {
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), result.Stdout()), "rendering mismatch")
})
t.Run("file", func(t *testing.T) {
cmd.Command = append(cmd.Command, "--output="+dir.Join("actual.yaml"))
icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Assert(t, is.Equal(readFile(t, filepath.Join(appPath, "expected.txt")), readFile(t, dir.Join("actual.yaml"))), "rendering mismatch")
})
}
}

Expand Down

0 comments on commit 39fdf4a

Please sign in to comment.