MCPcopy
hub / github.com/helm/helm / TestShowPreReleaseChart

Function TestShowPreReleaseChart

pkg/cmd/show_test.go:28–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestShowPreReleaseChart(t *testing.T) {
29 srv := repotest.NewTempServer(
30 t,
31 repotest.WithChartSourceGlob("testdata/testcharts/*.tgz*"),
32 )
33 defer srv.Stop()
34
35 if err := srv.LinkIndices(); err != nil {
36 t.Fatal(err)
37 }
38
39 tests := []struct {
40 name string
41 args string
42 flags string
43 fail bool
44 expectedErr string
45 }{
46 {
47 name: "show pre-release chart",
48 args: "test/pre-release-chart",
49 fail: true,
50 expectedErr: "chart \"pre-release-chart\" matching not found in test index. (try 'helm repo update'): no chart version found for pre-release-chart-",
51 },
52 {
53 name: "show pre-release chart",
54 args: "test/pre-release-chart",
55 fail: true,
56 flags: "--version 1.0.0",
57 expectedErr: "chart \"pre-release-chart\" matching 1.0.0 not found in test index. (try 'helm repo update'): no chart version found for pre-release-chart-1.0.0",
58 },
59 {
60 name: "show pre-release chart with 'devel' flag",
61 args: "test/pre-release-chart",
62 flags: "--devel",
63 fail: false,
64 },
65 }
66
67 contentTmp := t.TempDir()
68
69 for _, tt := range tests {
70 t.Run(tt.name, func(t *testing.T) {
71 outdir := srv.Root()
72 cmd := fmt.Sprintf("show all '%s' %s --repository-config %s --repository-cache %s --content-cache %s",
73 tt.args,
74 tt.flags,
75 filepath.Join(outdir, "repositories.yaml"),
76 outdir,
77 contentTmp,
78 )
79 //_, out, err := executeActionCommand(cmd)
80 _, _, err := executeActionCommand(cmd)
81 if err != nil {
82 if tt.fail {
83 if !strings.Contains(err.Error(), tt.expectedErr) {
84 t.Errorf("%q expected error: %s, got: %s", tt.name, tt.expectedErr, err.Error())
85 }

Callers

nothing calls this directly

Calls 10

NewTempServerFunction · 0.92
WithChartSourceGlobFunction · 0.92
executeActionCommandFunction · 0.85
StopMethod · 0.80
LinkIndicesMethod · 0.80
FatalMethod · 0.80
ContainsMethod · 0.80
RunMethod · 0.65
RootMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…