Files
my-rook-config/pkg/operator/k8sutil/prometheus_test.go
T
Travis Nielsen 4edcff04f7 monitoring: create prometheus rules with helm chart
The prometheus rules had been previously created if the cephcluster CR
setting monitoring.enabled was set to true. The rules were not customizable
and therefore not flexible enough. Now the rules are installed by the helm
chart. To customize the rules, a post-processor can be applied to the helm
chart.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-03-21 14:47:52 -06:00

39 lines
1.2 KiB
Go

/*
Copyright 2020 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package k8sutil for Kubernetes helpers.
package k8sutil
import (
"path"
"testing"
"github.com/rook/rook/pkg/util"
"github.com/stretchr/testify/assert"
)
func TestGetServiceMonitor(t *testing.T) {
projectRoot := util.PathToProjectRoot()
filePath := path.Join(projectRoot, "/deploy/examples/monitoring/service-monitor.yaml")
servicemonitor, err := GetServiceMonitor(filePath)
assert.Nil(t, err)
assert.Equal(t, "rook-ceph-mgr", servicemonitor.GetName())
assert.Equal(t, "rook-ceph", servicemonitor.GetNamespace())
assert.NotNil(t, servicemonitor.GetLabels())
assert.NotNil(t, servicemonitor.Spec.NamespaceSelector.MatchNames)
assert.NotNil(t, servicemonitor.Spec.Endpoints)
}