|
|
@ -59,6 +59,15 @@ entries:
|
|
|
|
version: 1.0.0
|
|
|
|
version: 1.0.0
|
|
|
|
home: https://github.com/something
|
|
|
|
home: https://github.com/something
|
|
|
|
digest: "sha256:1234567890abcdef"
|
|
|
|
digest: "sha256:1234567890abcdef"
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
indexWithEmptyEntry = `
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
|
|
|
entries:
|
|
|
|
|
|
|
|
grafana:
|
|
|
|
|
|
|
|
- apiVersion: v2
|
|
|
|
|
|
|
|
name: grafana
|
|
|
|
|
|
|
|
foo:
|
|
|
|
|
|
|
|
-
|
|
|
|
`
|
|
|
|
`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -152,6 +161,12 @@ func TestLoadIndex_Duplicates(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoadIndex_EmptyEntry(t *testing.T) {
|
|
|
|
|
|
|
|
if _, err := loadIndex([]byte(indexWithEmptyEntry), "indexWithEmptyEntry"); err != nil {
|
|
|
|
|
|
|
|
t.Errorf("unexpected error: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoadIndex_Empty(t *testing.T) {
|
|
|
|
func TestLoadIndex_Empty(t *testing.T) {
|
|
|
|
if _, err := loadIndex([]byte(""), "indexWithEmpty"); err == nil {
|
|
|
|
if _, err := loadIndex([]byte(""), "indexWithEmpty"); err == nil {
|
|
|
|
t.Errorf("Expected an error when index.yaml is empty.")
|
|
|
|
t.Errorf("Expected an error when index.yaml is empty.")
|
|
|
@ -526,3 +541,21 @@ func TestIndexWrite(t *testing.T) {
|
|
|
|
t.Fatal("Index files doesn't contain expected content")
|
|
|
|
t.Fatal("Index files doesn't contain expected content")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestAddFileIndexEntriesNil(t *testing.T) {
|
|
|
|
|
|
|
|
i := NewIndexFile()
|
|
|
|
|
|
|
|
i.APIVersion = chart.APIVersionV1
|
|
|
|
|
|
|
|
i.Entries = nil
|
|
|
|
|
|
|
|
for _, x := range []struct {
|
|
|
|
|
|
|
|
md *chart.Metadata
|
|
|
|
|
|
|
|
filename string
|
|
|
|
|
|
|
|
baseURL string
|
|
|
|
|
|
|
|
digest string
|
|
|
|
|
|
|
|
}{
|
|
|
|
|
|
|
|
{&chart.Metadata{APIVersion: "v2", Name: " ", Version: "8033-5.apinie+s.r"}, "setter-0.1.9+beta.tgz", "http://example.com/charts", "sha256:1234567890abc"},
|
|
|
|
|
|
|
|
} {
|
|
|
|
|
|
|
|
if err := i.MustAdd(x.md, x.filename, x.baseURL, x.digest); err == nil {
|
|
|
|
|
|
|
|
t.Errorf("expected err to be non-nil when entries not initialized")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|