Require a nonempty chart in Lint.Prepare [#3]

This commit is contained in:
Erin Call 2019-12-17 17:00:34 -08:00
parent a6b7e06bd2
commit a6a2d6e6a3
No known key found for this signature in database
GPG key ID: 4071FF6C15B8DAD1
2 changed files with 16 additions and 0 deletions

View file

@ -18,6 +18,10 @@ func (l *Lint) Execute(_ Config) error {
// Prepare gets the Lint ready to execute.
func (l *Lint) Prepare(cfg Config) error {
if l.Chart == "" {
return fmt.Errorf("chart is required")
}
args := make([]string, 0)
if cfg.Debug {

View file

@ -59,6 +59,18 @@ func (suite *LintTestSuite) TestPrepareAndExecute() {
l.Execute(cfg)
}
func (suite *LintTestSuite) TestPrepareRequiresChart() {
// These aren't really expected, but allowing them gives clearer test-failure messages
suite.mockCmd.EXPECT().Stdout(gomock.Any())
suite.mockCmd.EXPECT().Stderr(gomock.Any())
cfg := Config{}
l := Lint{}
err := l.Prepare(cfg)
suite.EqualError(err, "chart is required", "Chart should be mandatory")
}
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
defer suite.ctrl.Finish()