|
|
@ -21,6 +21,7 @@ import (
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"regexp"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
"helm.sh/helm/v3/internal/test/ensure"
|
|
|
|
"helm.sh/helm/v3/internal/test/ensure"
|
|
|
@ -59,6 +60,20 @@ func TestCreateCmd(t *testing.T) {
|
|
|
|
if c.Metadata.APIVersion != chart.APIVersionV2 {
|
|
|
|
if c.Metadata.APIVersion != chart.APIVersionV2 {
|
|
|
|
t.Errorf("Wrong API version: %q", c.Metadata.APIVersion)
|
|
|
|
t.Errorf("Wrong API version: %q", c.Metadata.APIVersion)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test that the name in Chart.yaml is quoted
|
|
|
|
|
|
|
|
chartPath := cname + "/Chart.yaml"
|
|
|
|
|
|
|
|
fileContent, err := ioutil.ReadFile(chartPath)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Errorf("Got error when reading Chart.yaml at path %q: %q", chartPath, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m, err := regexp.Match("\nname: \""+cname+"\"\n", fileContent)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Errorf("Could not apply regex for file %q", chartPath)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if !m {
|
|
|
|
|
|
|
|
t.Errorf("Could not find quoted name in %q", chartPath)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestCreateStarterCmd(t *testing.T) {
|
|
|
|
func TestCreateStarterCmd(t *testing.T) {
|
|
|
|