MCPcopy
hub / github.com/helm/helm / TestRepeatableSave

Function TestRepeatableSave

pkg/chart/v2/util/save_test.go:274–346  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

272}
273
274func TestRepeatableSave(t *testing.T) {
275 tmp := t.TempDir()
276 defer os.RemoveAll(tmp)
277 modTime := time.Date(2021, 9, 1, 20, 34, 58, 651387237, time.UTC)
278 tests := []struct {
279 name string
280 chart *chart.Chart
281 want string
282 }{
283 {
284 name: "Package 1 file",
285 chart: &chart.Chart{
286 Metadata: &chart.Metadata{
287 APIVersion: chart.APIVersionV2,
288 Name: "ahab",
289 Version: "1.2.3",
290 },
291 ModTime: modTime,
292 Lock: &chart.Lock{
293 Digest: "testdigest",
294 Generated: modTime,
295 },
296 Files: []*common.File{
297 {Name: "scheherazade/shahryar.txt", ModTime: modTime, Data: []byte("1,001 Nights")},
298 },
299 Schema: []byte("{\n \"title\": \"Values\"\n}"),
300 SchemaModTime: modTime,
301 },
302 want: "fea2662522317b65c2788ff9e5fc446a9264830038dac618d4449493d99b3257",
303 },
304 {
305 name: "Package 2 files",
306 chart: &chart.Chart{
307 Metadata: &chart.Metadata{
308 APIVersion: chart.APIVersionV2,
309 Name: "ahab",
310 Version: "1.2.3",
311 },
312 ModTime: modTime,
313 Lock: &chart.Lock{
314 Digest: "testdigest",
315 Generated: modTime,
316 },
317 Files: []*common.File{
318 {Name: "scheherazade/shahryar.txt", ModTime: modTime, Data: []byte("1,001 Nights")},
319 {Name: "scheherazade/dunyazad.txt", ModTime: modTime, Data: []byte("1,001 Nights again")},
320 },
321 Schema: []byte("{\n \"title\": \"Values\"\n}"),
322 SchemaModTime: modTime,
323 },
324 want: "7ae92b2f274bb51ea3f1969e4187d78cc52b5f6f663b44b8fb3b40bcb8ee46f3",
325 },
326 }
327 for _, test := range tests {
328 t.Run(test.name, func(t *testing.T) {
329 // create package
330 dest := path.Join(tmp, "newdir")
331 where, err := Save(test.chart, dest)

Callers

nothing calls this directly

Calls 4

FatalfMethod · 0.80
SaveFunction · 0.70
sha256SumFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…