|
|
|
@ -159,3 +159,53 @@ func TestChartFullPath(t *testing.T) {
|
|
|
|
|
is.Equal("foo/charts/", chrt1.ChartFullPath())
|
|
|
|
|
is.Equal("foo", chrt2.ChartFullPath())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestCRDObjects(t *testing.T) {
|
|
|
|
|
chrt := Chart{
|
|
|
|
|
Files: []*File{
|
|
|
|
|
{
|
|
|
|
|
Name: "crds/foo.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Name: "bar.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Name: "crds/foo/bar/baz.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Name: "crdsfoo/bar/baz.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Name: "crds/README.md",
|
|
|
|
|
Data: []byte("# hello"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expected := []CRD{
|
|
|
|
|
{
|
|
|
|
|
Name: "crds/foo.yaml",
|
|
|
|
|
Filename: "crds/foo.yaml",
|
|
|
|
|
File: &File{
|
|
|
|
|
Name: "crds/foo.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Name: "crds/foo/bar/baz.yaml",
|
|
|
|
|
Filename: "crds/foo/bar/baz.yaml",
|
|
|
|
|
File: &File{
|
|
|
|
|
Name: "crds/foo/bar/baz.yaml",
|
|
|
|
|
Data: []byte("hello"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
is := assert.New(t)
|
|
|
|
|
crds := chrt.CRDObjects()
|
|
|
|
|
is.Equal(expected, crds)
|
|
|
|
|
}
|
|
|
|
|