Skip to content

Commit

Permalink
Fix printing test results on error (#218)
Browse files Browse the repository at this point in the history
* Fix a regression that would cause test results no to be printed on error
* No longer print usage output on error

Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
  • Loading branch information
unguiculus committed Mar 28, 2020
1 parent 6f5f4d9 commit d961652
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ct/cmd/install.go
Expand Up @@ -91,11 +91,12 @@ func install(cmd *cobra.Command, args []string) error {
fmt.Println(err)
}
results, err := testing.InstallCharts()
testing.PrintResults(results)

if err != nil {
return fmt.Errorf("Error installing charts: %s", err)
}

fmt.Println("All charts installed successfully")
testing.PrintResults(results)
return nil
}
3 changes: 2 additions & 1 deletion ct/cmd/lint.go
Expand Up @@ -83,11 +83,12 @@ func lint(cmd *cobra.Command, args []string) error {
return err
}
results, err := testing.LintCharts()
testing.PrintResults(results)

if err != nil {
return fmt.Errorf("Error linting charts: %s", err)
}

fmt.Println("All charts linted successfully")
testing.PrintResults(results)
return nil
}
3 changes: 2 additions & 1 deletion ct/cmd/lintAndInstall.go
Expand Up @@ -51,11 +51,12 @@ func lintAndInstall(cmd *cobra.Command, args []string) error {
return err
}
results, err := testing.LintAndInstallCharts()
testing.PrintResults(results)

if err != nil {
return fmt.Errorf("Error linting and installing charts: %s", err)
}

fmt.Println("All charts linted and installed successfully")
testing.PrintResults(results)
return nil
}
1 change: 1 addition & 0 deletions ct/cmd/root.go
Expand Up @@ -39,6 +39,7 @@ func NewRootCmd() *cobra.Command {
* all charts
in given chart directories.`),
SilenceUsage: true,
}

cmd.AddCommand(newLintCmd())
Expand Down

0 comments on commit d961652

Please sign in to comment.