|
|
@ -49,6 +49,9 @@ func TestSave(t *testing.T) {
|
|
|
|
Name: "ahab",
|
|
|
|
Name: "ahab",
|
|
|
|
Version: "1.2.3",
|
|
|
|
Version: "1.2.3",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
Lock: &chart.Lock{
|
|
|
|
|
|
|
|
Digest: "testdigest",
|
|
|
|
|
|
|
|
},
|
|
|
|
Files: []*chart.File{
|
|
|
|
Files: []*chart.File{
|
|
|
|
{Name: "scheherazade/shahryar.txt", Data: []byte("1,001 Nights")},
|
|
|
|
{Name: "scheherazade/shahryar.txt", Data: []byte("1,001 Nights")},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -77,6 +80,9 @@ func TestSave(t *testing.T) {
|
|
|
|
if len(c2.Files) != 1 || c2.Files[0].Name != "scheherazade/shahryar.txt" {
|
|
|
|
if len(c2.Files) != 1 || c2.Files[0].Name != "scheherazade/shahryar.txt" {
|
|
|
|
t.Fatal("Files data did not match")
|
|
|
|
t.Fatal("Files data did not match")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if c2.Lock != nil {
|
|
|
|
|
|
|
|
t.Fatal("Expected v1 chart archive not to contain Chart.lock file")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if !bytes.Equal(c.Schema, c2.Schema) {
|
|
|
|
if !bytes.Equal(c.Schema, c2.Schema) {
|
|
|
|
indentation := 4
|
|
|
|
indentation := 4
|
|
|
@ -87,6 +93,22 @@ func TestSave(t *testing.T) {
|
|
|
|
if _, err := Save(&chartWithInvalidJSON, dest); err == nil {
|
|
|
|
if _, err := Save(&chartWithInvalidJSON, dest); err == nil {
|
|
|
|
t.Fatalf("Invalid JSON was not caught while saving chart")
|
|
|
|
t.Fatalf("Invalid JSON was not caught while saving chart")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.Metadata.APIVersion = chart.APIVersionV2
|
|
|
|
|
|
|
|
where, err = Save(c, dest)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatalf("Failed to save: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
c2, err = loader.LoadFile(where)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if c2.Lock == nil {
|
|
|
|
|
|
|
|
t.Fatal("Expected v2 chart archive to containe a Chart.lock file")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if c2.Lock.Digest != c.Lock.Digest {
|
|
|
|
|
|
|
|
t.Fatal("Chart.lock data did not match")
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|