forked from openshift/compliance-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
operator_test.go
26 lines (24 loc) · 888 Bytes
/
operator_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/compliance-operator/pkg/controller/metrics"
)
var _ = Describe("Operator Startup Function tests", func() {
Context("Service Monitor Creation", func() {
When("Installing to non-controlled namespace", func() {
It("ServiceMonitor is generated with the proper TLSConfig ServerName", func() {
metricService := operatorMetricService("foobar")
sm := generateOperatorServiceMonitor(metricService, "foobar")
controllerMetricServiceFound := false
for _, ep := range sm.Spec.Endpoints {
if ep.Port == metrics.ControllerMetricsServiceName && ep.TLSConfig != nil {
Expect(ep.TLSConfig.ServerName).To(BeEquivalentTo("metrics.foobar.svc"))
controllerMetricServiceFound = true
}
}
Expect(controllerMetricServiceFound).To(BeTrue())
})
})
})
})