MCPcopy
hub / github.com/helm/helm / TestSetAppVersion

Function TestSetAppVersion

pkg/cmd/package_test.go:169–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestSetAppVersion(t *testing.T) {
170 var ch *chart.Chart
171 expectedAppVersion := "app-version-foo"
172 chartToPackage := "testdata/testcharts/alpine"
173 dir := t.TempDir()
174 cmd := fmt.Sprintf("package %s --destination=%s --app-version=%s", chartToPackage, dir, expectedAppVersion)
175 _, output, err := executeActionCommand(cmd)
176 if err != nil {
177 t.Logf("Output: %s", output)
178 t.Fatal(err)
179 }
180 chartPath := filepath.Join(dir, "alpine-0.1.0.tgz")
181 if fi, err := os.Stat(chartPath); err != nil {
182 t.Errorf("expected file %q, got err %q", chartPath, err)
183 } else if fi.Size() == 0 {
184 t.Errorf("file %q has zero bytes.", chartPath)
185 }
186 ch, err = loader.Load(chartPath)
187 if err != nil {
188 t.Fatalf("unexpected error loading packaged chart: %v", err)
189 }
190 if ch.Metadata.AppVersion != expectedAppVersion {
191 t.Errorf("expected app-version %q, found %q", expectedAppVersion, ch.Metadata.AppVersion)
192 }
193}
194
195func TestPackageFileCompletion(t *testing.T) {
196 checkFileCompletion(t, "package", true)

Callers

nothing calls this directly

Calls 4

LoadFunction · 0.92
executeActionCommandFunction · 0.85
FatalMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…