diff --git a/internal/run/lint.go b/internal/run/lint.go index bdc4f8c..aa18128 100644 --- a/internal/run/lint.go +++ b/internal/run/lint.go @@ -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 { diff --git a/internal/run/lint_test.go b/internal/run/lint_test.go index 25a6f26..9f88598 100644 --- a/internal/run/lint_test.go +++ b/internal/run/lint_test.go @@ -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()