Use better expectations in lint_test [#3]
The tests need to allow calls to Stdout/Stderr so they don't get "Unexpected call" errors from gomock, but these tests aren't meant to assert that the calls actually happened. Using .AnyTimes allows 0 or more calls.
This commit is contained in:
parent
84ac019838
commit
b93917c857
|
@ -61,8 +61,8 @@ func (suite *LintTestSuite) TestPrepareAndExecute() {
|
||||||
|
|
||||||
func (suite *LintTestSuite) TestPrepareRequiresChart() {
|
func (suite *LintTestSuite) TestPrepareRequiresChart() {
|
||||||
// These aren't really expected, but allowing them gives clearer test-failure messages
|
// These aren't really expected, but allowing them gives clearer test-failure messages
|
||||||
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||||
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||||
|
|
||||||
cfg := Config{}
|
cfg := Config{}
|
||||||
l := Lint{}
|
l := Lint{}
|
||||||
|
@ -96,8 +96,8 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
return suite.mockCmd
|
return suite.mockCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||||
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||||
|
|
||||||
err := l.Prepare(cfg)
|
err := l.Prepare(cfg)
|
||||||
suite.Require().Nil(err)
|
suite.Require().Nil(err)
|
||||||
|
@ -126,7 +126,7 @@ func (suite *LintTestSuite) TestPrepareWithDebugFlag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
||||||
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
suite.mockCmd.EXPECT().Stderr(&stderr)
|
||||||
|
|
||||||
err := l.Prepare(cfg)
|
err := l.Prepare(cfg)
|
||||||
suite.Require().Nil(err)
|
suite.Require().Nil(err)
|
||||||
|
@ -152,8 +152,8 @@ func (suite *LintTestSuite) TestPrepareWithNamespaceFlag() {
|
||||||
return suite.mockCmd
|
return suite.mockCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||||
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||||
|
|
||||||
err := l.Prepare(cfg)
|
err := l.Prepare(cfg)
|
||||||
suite.Require().Nil(err)
|
suite.Require().Nil(err)
|
||||||
|
|
Loading…
Reference in a new issue