func TestLintAll(t *testing.T) { tmpHome := test.CreateTmpHome() test.FakeUpdate(tmpHome) missingReadmeChart := "missingReadme" action.Create(missingReadmeChart, tmpHome) os.Remove(util.WorkspaceChartDirectory(tmpHome, missingReadmeChart, "README.md")) action.Create("goodChart", tmpHome) output := test.CaptureOutput(func() { Cli().Run([]string{"helmc", "--home", tmpHome, "lint", "--all"}) }) test.ExpectMatches(t, output, "A README file was not found.*"+missingReadmeChart) test.ExpectContains(t, output, "Chart [goodChart] has passed all necessary checks") test.ExpectContains(t, output, "Chart [missingReadme] failed some checks") }
func TestLintChartByPath(t *testing.T) { home1 := test.CreateTmpHome() home2 := test.CreateTmpHome() chartName := "goodChart" action.Create(chartName, home1) output := test.CaptureOutput(func() { Cli().Run([]string{"helmc", "--home", home2, "lint", util.WorkspaceChartDirectory(home1, chartName)}) }) test.ExpectContains(t, output, fmt.Sprintf("Chart [%s] has passed all necessary checks", chartName)) }
func TestLintSingle(t *testing.T) { tmpHome := test.CreateTmpHome() test.FakeUpdate(tmpHome) chartName := "goodChart" action.Create(chartName, tmpHome) output := test.CaptureOutput(func() { Cli().Run([]string{"helmc", "--home", tmpHome, "lint", chartName}) }) test.ExpectContains(t, output, fmt.Sprintf("Chart [%s] has passed all necessary checks", chartName)) }
package cli import ( "github.com/codegangsta/cli" "github.com/helm/helm-classic/action" ) const createDescription = `This will scaffold a new chart named 'chart-name' in your local workdir. To edit the resulting chart, you may edit the files directly or use the 'helmc edit' command.` var createCmd = cli.Command{ Name: "create", Usage: "Create a chart in the local workspace.", Description: createDescription, ArgsUsage: "[chart-name]", Action: func(c *cli.Context) { minArgs(c, 1, "create") action.Create(c.Args()[0], home(c)) }, }