|
|
|
@ -19,7 +19,10 @@ package cmd
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"helm.sh/helm/v4/pkg/repo/v1/repotest"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var chartPath = "testdata/testcharts/subchart"
|
|
|
|
var chartPath = "testdata/testcharts/subchart"
|
|
|
|
@ -176,6 +179,39 @@ func TestTemplateCmd(t *testing.T) {
|
|
|
|
runTestCmd(t, tests)
|
|
|
|
runTestCmd(t, tests)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestTemplateOCIChartDoesNotPrintRegistryPullMetadata(t *testing.T) {
|
|
|
|
|
|
|
|
srv := repotest.NewTempServer(
|
|
|
|
|
|
|
|
t,
|
|
|
|
|
|
|
|
repotest.WithChartSourceGlob("testdata/testcharts/*.tgz*"),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
defer srv.Stop()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ociSrv, err := repotest.NewOCIServer(t, srv.Root())
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ociSrv.Run(t)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contentTmp := t.TempDir()
|
|
|
|
|
|
|
|
outdir := srv.Root()
|
|
|
|
|
|
|
|
cmd := fmt.Sprintf("template --generate-name oci://%s/u/ocitestuser/oci-dependent-chart --version 0.1.0 --registry-config %s --content-cache %s --plain-http",
|
|
|
|
|
|
|
|
ociSrv.RegistryURL,
|
|
|
|
|
|
|
|
filepath.Join(outdir, "config.json"),
|
|
|
|
|
|
|
|
contentTmp,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, out, err := executeActionCommand(cmd)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatalf("unexpected error: %v", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.Contains(out, "Pulled: ") || strings.Contains(out, "Digest: ") {
|
|
|
|
|
|
|
|
t.Fatalf("expected OCI template output to exclude registry pull metadata, got: %s", out)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if !strings.Contains(out, "# Source:") {
|
|
|
|
|
|
|
|
t.Fatalf("expected rendered manifests in output, got: %s", out)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestTemplateVersionCompletion(t *testing.T) {
|
|
|
|
func TestTemplateVersionCompletion(t *testing.T) {
|
|
|
|
repoFile := "testdata/helmhome/helm/repositories.yaml"
|
|
|
|
repoFile := "testdata/helmhome/helm/repositories.yaml"
|
|
|
|
repoCache := "testdata/helmhome/helm/repository"
|
|
|
|
repoCache := "testdata/helmhome/helm/repository"
|
|
|
|
|