Renaming the function to address the feedback

-e
Signed-off-by: Payal Godhani <godhanipayal@gmail.com>
pull/13678/head
Payal Godhani 8 months ago
parent 286d4921c2
commit 5c26a9850b

@ -789,7 +789,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
dl.Verify = downloader.VerifyAlways
}
if c.RepoURL != "" {
chartURL, err := repo.FindChartInAuthRepoURL(c.RepoURL, c.Username, c.Password, name, version,
chartURL, err := repo.FindChartRepoURL(c.RepoURL, c.Username, c.Password, name, version,
c.CertFile, c.KeyFile, c.CaFile, c.InsecureSkipTLSverify, c.PassCredentialsAll, getter.All(settings))
if err != nil {
return "", err

@ -117,7 +117,7 @@ func (p *Pull) Run(chartRef string) (string, error) {
}
if p.RepoURL != "" {
chartURL, err := repo.FindChartInAuthRepoURL(p.RepoURL, p.Username, p.Password, chartRef, p.Version,
chartURL, err := repo.FindChartRepoURL(p.RepoURL, p.Username, p.Password, chartRef, p.Version,
p.CertFile, p.KeyFile, p.CaFile, p.InsecureSkipTLSverify, p.PassCredentialsAll, getter.All(p.Settings))
if err != nil {
return out.String(), err

@ -742,7 +742,7 @@ func (m *Manager) findChartURL(name, version, repoURL string, repos map[string]*
return
}
}
url, err = repo.FindChartInAuthRepoURL(repoURL, "", "", name, version, certFile, keyFile, caFile, false, false, m.Getters)
url, err = repo.FindChartRepoURL(repoURL, "", "", name, version, certFile, keyFile, caFile, false, false, m.Getters)
if err == nil {
return url, username, password, false, false, "", "", "", err
}

@ -196,9 +196,9 @@ func (r *ChartRepository) generateIndex() error {
return nil
}
// FindChartInAuthRepoURL finds chart in chart repository pointed by repoURL
// FindChartRepoURL finds chart in chart repository pointed by repoURL
// without adding repo to repositories, and supports authentication, TLS settings, and optional passing of credentials to other domains.
func FindChartInAuthRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, insecureSkipTLSverify, passCredentialsAll bool, getters getter.Providers) (string, error) {
func FindChartRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, insecureSkipTLSverify, passCredentialsAll bool, getters getter.Providers) (string, error) {
// Download and write the index file to a temporary location
buf := make([]byte, 20)
rand.Read(buf)

@ -297,7 +297,7 @@ func TestChartInAuthRepoURL(t *testing.T) {
}
defer srv.Close()
chartURL, err := FindChartInAuthRepoURL(srv.URL, "", "", "nginx", "", "", "", "", true, false, getter.All(&cli.EnvSettings{}))
chartURL, err := FindChartRepoURL(srv.URL, "", "", "nginx", "", "", "", "", true, false, getter.All(&cli.EnvSettings{}))
if err != nil {
t.Fatalf("%v", err)
}
@ -306,7 +306,7 @@ func TestChartInAuthRepoURL(t *testing.T) {
}
// If the insecureSkipTLSVerify is false, it will return an error that contains "x509: certificate signed by unknown authority".
_, err = FindChartInAuthRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
_, err = FindChartRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
// Go communicates with the platform and different platforms return different messages. Go itself tests darwin
// differently for its message. On newer versions of Darwin the message includes the "Acme Co" portion while older
// versions of Darwin do not. As there are people developing Helm using both old and new versions of Darwin we test
@ -327,7 +327,7 @@ func TestFindChartInRepoURL(t *testing.T) {
}
defer srv.Close()
chartURL, err := FindChartInAuthRepoURL(srv.URL, "", "", "nginx", "", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
chartURL, err := FindChartRepoURL(srv.URL, "", "", "nginx", "", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
if err != nil {
t.Fatalf("%v", err)
}
@ -335,7 +335,7 @@ func TestFindChartInRepoURL(t *testing.T) {
t.Errorf("%s is not the valid URL", chartURL)
}
chartURL, err = FindChartInAuthRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
chartURL, err = FindChartRepoURL(srv.URL, "", "", "nginx", "0.1.0", "", "", "", false, false, getter.All(&cli.EnvSettings{}))
if err != nil {
t.Errorf("%s", err)
}
@ -350,7 +350,7 @@ func TestErrorFindChartInRepoURL(t *testing.T) {
RepositoryCache: t.TempDir(),
})
if _, err := FindChartInAuthRepoURL("http://someserver/something", "", "", "nginx", "", "", "", "", false, false, g); err == nil {
if _, err := FindChartRepoURL("http://someserver/something", "", "", "nginx", "", "", "", "", false, false, g); err == nil {
t.Errorf("Expected error for bad chart URL, but did not get any errors")
} else if !strings.Contains(err.Error(), `looks like "http://someserver/something" is not a valid chart repository or cannot be reached`) {
t.Errorf("Expected error for bad chart URL, but got a different error (%v)", err)
@ -362,19 +362,19 @@ func TestErrorFindChartInRepoURL(t *testing.T) {
}
defer srv.Close()
if _, err = FindChartInAuthRepoURL(srv.URL, "", "", "nginx1", "", "", "", "", false, false, g); err == nil {
if _, err = FindChartRepoURL(srv.URL, "", "", "nginx1", "", "", "", "", false, false, g); err == nil {
t.Errorf("Expected error for chart not found, but did not get any errors")
} else if err.Error() != `chart "nginx1" not found in `+srv.URL+` repository` {
t.Errorf("Expected error for chart not found, but got a different error (%v)", err)
}
if _, err = FindChartInAuthRepoURL(srv.URL, "", "", "nginx1", "0.1.0", "", "", "", false, false, g); err == nil {
if _, err = FindChartRepoURL(srv.URL, "", "", "nginx1", "0.1.0", "", "", "", false, false, g); err == nil {
t.Errorf("Expected error for chart not found, but did not get any errors")
} else if err.Error() != `chart "nginx1" version "0.1.0" not found in `+srv.URL+` repository` {
t.Errorf("Expected error for chart not found, but got a different error (%v)", err)
}
if _, err = FindChartInAuthRepoURL(srv.URL, "", "", "chartWithNoURL", "", "", "", "", false, false, g); err == nil {
if _, err = FindChartRepoURL(srv.URL, "", "", "chartWithNoURL", "", "", "", "", false, false, g); err == nil {
t.Errorf("Expected error for no chart URLs available, but did not get any errors")
} else if err.Error() != `chart "chartWithNoURL" has no downloadable URLs` {
t.Errorf("Expected error for chart not found, but got a different error (%v)", err)

Loading…
Cancel
Save