Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions internal/controllers/operator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ var _ = Describe("Operator Controller Test", func() {
BeforeEach(func() {
By("initializing cluster state")
pkgName = "prometheus"
pkgChan = "alpha"
pkgChan = "non-existent"
operator = &operatorsv1alpha1.Operator{
ObjectMeta: metav1.ObjectMeta{Name: opKey.Name},
Spec: operatorsv1alpha1.OperatorSpec{
Expand Down Expand Up @@ -1048,28 +1048,27 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
}
}

var betaChannel = catalogmetadata.Channel{Channel: declcfg.Channel{
Name: "beta",
Entries: []declcfg.ChannelEntry{
{
Name: "operatorhub/prometheus/0.37.0",
},
{
Name: "operatorhub/prometheus/0.47.0",
Replaces: "operatorhub/prometheus/0.37.0",
},
{
Name: "operatorhub/plain/0.1.0",
},
{
Name: "operatorhub/badmedia/0.1.0",
},
},
}}
var (
alphaChannel = catalogmetadata.Channel{Channel: declcfg.Channel{
Name: "alpha",
}}
betaChannel = catalogmetadata.Channel{Channel: declcfg.Channel{
Name: "beta",
}}
)

var testBundleList = []*catalogmetadata.Bundle{
{Bundle: declcfg.Bundle{
Name: "operatorhub/prometheus/0.37.0",
Name: "operatorhub/prometheus/alpha/0.37.0",
Package: "prometheus",
Image: "quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35",
Properties: []property.Property{
{Type: property.TypePackage, Value: json.RawMessage(`{"packageName":"prometheus","version":"0.37.0"}`)},
{Type: property.TypeGVK, Value: json.RawMessage(`[]`)},
},
}, InChannels: []*catalogmetadata.Channel{&alphaChannel}},
{Bundle: declcfg.Bundle{
Name: "operatorhub/prometheus/beta/0.37.0",
Package: "prometheus",
Image: "quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35",
Properties: []property.Property{
Expand All @@ -1078,7 +1077,7 @@ var testBundleList = []*catalogmetadata.Bundle{
},
}, InChannels: []*catalogmetadata.Channel{&betaChannel}},
{Bundle: declcfg.Bundle{
Name: "operatorhub/prometheus/0.47.0",
Name: "operatorhub/prometheus/beta/0.47.0",
Package: "prometheus",
Image: "quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed",
Properties: []property.Property{
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ var _ = Describe("Operator Install", func() {
BeforeEach(func() {
operator.Spec = operatorv1alpha1.OperatorSpec{
PackageName: "prometheus",
Version: "0.47.0",
}
})
It("resolves the specified package with correct bundle path", func() {
Expand All @@ -69,7 +68,7 @@ var _ = Describe("Operator Install", func() {
g.Expect(cond.Status).To(Equal(metav1.ConditionTrue))
g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonSuccess))
g.Expect(cond.Message).To(ContainSubstring("resolved to"))
g.Expect(operator.Status.ResolvedBundleResource).ToNot(BeEmpty())
g.Expect(operator.Status.ResolvedBundleResource).To(Equal("localhost/testdata/bundles/registry-v1/prometheus-operator:v0.65.1"))
}).Should(Succeed())

By("eventually installing the package successfully")
Expand Down
6 changes: 6 additions & 0 deletions testdata/catalogs/test-catalog/catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ name: prometheus
defaultChannel: beta
---
schema: olm.channel
name: alpha
package: prometheus
entries:
- name: prometheus-operator.0.47.0
---
schema: olm.channel
name: beta
package: prometheus
entries:
Expand Down