forked from rook/rook
The crash collector controller is designed for watching nodes where ceph daemons are running, and ensuring a special daemon is running on that node to provide additional support for ceph on that node. The crash collector is the first example of a daemon that should be running on all the ceph daemon nodes. The next example of such a node daemon will be the ceph exporter that will listen for the ceph metrics as described in the design doc. https://github.com/rook/rook/blob/master/design/ceph/ceph-exporter.md Now the crash collector controller is renamed to the node daemon controller so the ceph exporter daemon can also be managed by the same controller. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
/*
|
|
Copyright 2019 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 nodedaemon
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsCephPod(t *testing.T) {
|
|
labels := make(map[string]string)
|
|
|
|
labels["foo"] = "bar"
|
|
podName := "ceph"
|
|
b := isCephPod(labels, podName)
|
|
assert.False(t, b)
|
|
|
|
// Label is correct but this is a canary pod, this is not valid!
|
|
podName = "rook-ceph-mon-b-canary-664f5bf8cd-697hh"
|
|
labels["rook_cluster"] = "rook-ceph"
|
|
b = isCephPod(labels, podName)
|
|
assert.False(t, b)
|
|
|
|
// Label is correct and this is not a canary pod
|
|
podName = "rook-ceph-mon"
|
|
b = isCephPod(labels, podName)
|
|
assert.True(t, b)
|
|
}
|