Skip to content

Commit eafed6f

Browse files
committed
Add an e2e test case to check the prometheus rule
1 parent af2d7a8 commit eafed6f

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

test/cvo/accept_risks.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
g "github.com/onsi/ginkgo/v2"
88
o "github.com/onsi/gomega"
9+
prometheusoperatorv1client "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
910

1011
"k8s.io/apimachinery/pkg/api/meta"
1112
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -23,9 +24,10 @@ import (
2324
var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`, func() {
2425

2526
var (
26-
c *rest.Config
27-
configClient *configv1client.ConfigV1Client
28-
err error
27+
c *rest.Config
28+
configClient *configv1client.ConfigV1Client
29+
monitoringClient *prometheusoperatorv1client.MonitoringV1Client
30+
err error
2931

3032
ctx = context.TODO()
3133
needRecover bool
@@ -37,6 +39,8 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`,
3739
o.Expect(err).To(o.BeNil())
3840
configClient, err = configv1client.NewForConfig(c)
3941
o.Expect(err).To(o.BeNil())
42+
monitoringClient, err = prometheusoperatorv1client.NewForConfig(c)
43+
o.Expect(err).To(o.BeNil())
4044

4145
util.SkipIfNotTechPreviewNoUpgrade(ctx, c)
4246
o.Expect(util.SkipIfHypershift(ctx, c)).To(o.BeNil())
@@ -142,4 +146,11 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`,
142146
o.Expect(cv.Status.ConditionalUpdates).To(o.HaveLen(conditionalUpdatesLength))
143147
o.Expect(releasesNow).To(o.Equal(releases))
144148
})
149+
150+
g.It("should install prometheus rules correctly", func() {
151+
_, err = monitoringClient.PrometheusRules(external.DefaultCVONamespace).Get(ctx, "cluster-version-operator-accept-risks", metav1.GetOptions{})
152+
if err != nil {
153+
o.Expect(err).NotTo(o.HaveOccurred())
154+
}
155+
})
145156
})

0 commit comments

Comments
 (0)