Require a nonempty chart in Lint.Prepare [#3]
This commit is contained in:
parent
a6b7e06bd2
commit
a6a2d6e6a3
|
@ -18,6 +18,10 @@ func (l *Lint) Execute(_ Config) error {
|
||||||
|
|
||||||
// Prepare gets the Lint ready to execute.
|
// Prepare gets the Lint ready to execute.
|
||||||
func (l *Lint) Prepare(cfg Config) error {
|
func (l *Lint) Prepare(cfg Config) error {
|
||||||
|
if l.Chart == "" {
|
||||||
|
return fmt.Errorf("chart is required")
|
||||||
|
}
|
||||||
|
|
||||||
args := make([]string, 0)
|
args := make([]string, 0)
|
||||||
|
|
||||||
if cfg.Debug {
|
if cfg.Debug {
|
||||||
|
|
|
@ -59,6 +59,18 @@ func (suite *LintTestSuite) TestPrepareAndExecute() {
|
||||||
l.Execute(cfg)
|
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() {
|
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
defer suite.ctrl.Finish()
|
defer suite.ctrl.Finish()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue