Assert that Lint.Prepare sets cmd.Stdout/Stderr [#3]

This commit is contained in:
Erin Call 2019-12-19 10:26:33 -08:00
parent b93917c857
commit 30e1e3b99f
No known key found for this signature in database
GPG key ID: 4071FF6C15B8DAD1

View file

@ -34,9 +34,16 @@ func TestLintTestSuite(t *testing.T) {
func (suite *LintTestSuite) TestPrepareAndExecute() { func (suite *LintTestSuite) TestPrepareAndExecute() {
defer suite.ctrl.Finish() defer suite.ctrl.Finish()
stdout := strings.Builder{}
stderr := strings.Builder{}
l := Lint{ l := Lint{
Chart: "./epic/mychart", Chart: "./epic/mychart",
} }
cfg := Config{
Stdout: &stdout,
Stderr: &stderr,
}
command = func(path string, args ...string) cmd { command = func(path string, args ...string) cmd {
suite.Equal(helmBin, path) suite.Equal(helmBin, path)
@ -46,14 +53,13 @@ func (suite *LintTestSuite) TestPrepareAndExecute() {
} }
suite.mockCmd.EXPECT(). suite.mockCmd.EXPECT().
Stdout(gomock.Any()) Stdout(&stdout)
suite.mockCmd.EXPECT(). suite.mockCmd.EXPECT().
Stderr(gomock.Any()) Stderr(&stderr)
suite.mockCmd.EXPECT(). suite.mockCmd.EXPECT().
Run(). Run().
Times(1) Times(1)
cfg := Config{}
err := l.Prepare(cfg) err := l.Prepare(cfg)
suite.Require().Nil(err) suite.Require().Nil(err)
l.Execute(cfg) l.Execute(cfg)