2018-05-18 14:32:20 -07:00
|
|
|
/*
|
2020-04-17 18:40:54 +02:00
|
|
|
Copyright 2020 The Rook Authors. All rights reserved.
|
2018-05-18 14:32:20 -07:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|
2018-08-31 13:39:02 -06:00
|
|
|
|
2018-05-18 14:32:20 -07:00
|
|
|
package cluster
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2018-12-03 15:08:29 -07:00
|
|
|
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
2018-05-18 14:32:20 -07:00
|
|
|
"github.com/stretchr/testify/assert"
|
2020-04-17 18:40:54 +02:00
|
|
|
corev1 "k8s.io/api/core/v1"
|
2018-05-18 14:32:20 -07:00
|
|
|
)
|
|
|
|
|
|
2020-04-17 18:40:54 +02:00
|
|
|
func TestIsHotPlugCM(t *testing.T) {
|
2021-03-26 14:52:37 -06:00
|
|
|
blockPool := &cephv1.CephBlockPool{}
|
2018-05-18 14:32:20 -07:00
|
|
|
|
2021-03-26 14:52:37 -06:00
|
|
|
assert.False(t, isHotPlugCM(blockPool))
|
2020-04-17 18:40:54 +02:00
|
|
|
|
|
|
|
|
cm := &corev1.ConfigMap{}
|
2021-03-26 14:52:37 -06:00
|
|
|
assert.False(t, isHotPlugCM(cm))
|
2020-04-17 18:40:54 +02:00
|
|
|
|
|
|
|
|
cm.Labels = map[string]string{
|
|
|
|
|
"foo": "bar",
|
|
|
|
|
}
|
2021-03-26 14:52:37 -06:00
|
|
|
assert.False(t, isHotPlugCM(cm))
|
2020-04-17 18:40:54 +02:00
|
|
|
|
|
|
|
|
cm.Labels["app"] = "rook-discover"
|
2021-03-26 14:52:37 -06:00
|
|
|
assert.True(t, isHotPlugCM(cm))
|
2018-05-18 14:32:20 -07:00
|
|
|
}
|