Skip to content
Snippets Groups Projects

Add utilities to support working with Kubernetes object collections

Merged Hossein Pursultani requested to merge hp-objects-support into master
All threads resolved!
3 files
+ 87
79
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -7,85 +7,6 @@ import (
"helm.sh/helm/v3/pkg/chart"
)
func newTestChart(name, version, appVersion string) *chart.Chart {
return &chart.Chart{
Metadata: &chart.Metadata{
Name: name,
Version: version,
AppVersion: appVersion,
},
}
}
var _ = Describe("Criterion", func() {
Describe("WithName", func() {
It("matches Chart name", func() {
Expect(WithName("test")(newTestChart("test", "", ""))).To(BeTrue())
Expect(WithName("test")(newTestChart("not-test", "", ""))).To(BeFalse())
})
})
Describe("WithVersion", func() {
It("matches Chart version", func() {
Expect(WithVersion("1")(newTestChart("", "1", ""))).To(BeTrue())
Expect(WithVersion("1")(newTestChart("", "2", ""))).To(BeFalse())
})
})
Describe("WithAppVersion", func() {
It("matches Chart appVersion", func() {
Expect(WithAppVersion("1")(newTestChart("", "", "1"))).To(BeTrue())
Expect(WithAppVersion("1")(newTestChart("", "", "2"))).To(BeFalse())
})
})
Describe("All", func() {
Expect(
All(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("test", "1", "1"))).To(BeTrue())
Expect(
All(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("test", "1", "2"))).To(BeFalse())
})
Describe("Any", func() {
Expect(
Any(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("test", "", ""))).To(BeTrue())
Expect(
Any(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("", "", ""))).To(BeFalse())
})
Describe("None", func() {
Expect(
None(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("", "", ""))).To(BeTrue())
Expect(
None(
WithName("test"),
WithVersion("1"),
WithAppVersion("1"),
)(newTestChart("test", "", ""))).To(BeFalse())
})
})
var _ = Describe("Catalog", func() {
It("is empty after initialization", func() {
Expect(Catalog{}).To(BeEmpty())
Loading