ceph: remove DaemonType type

This type was a string already and was just making us doing string()
calls all the time to it's not worth it.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-04-01 09:08:18 +02:00
1 parent 7788901a88
commit 040193bb5a
21 files changed
+44 -66

No files matched your search

+3 -3
View File
@@ -65,7 +65,7 @@ func NewPodSpecTester(t *testing.T, spec *v1.PodSpec) *PodSpecTester {
// AssertVolumesMeetCephRequirements asserts that all the required Ceph volumes exist in the pod
// spec under test, Volumes list.
func (ps *PodSpecTester) AssertVolumesMeetCephRequirements(
daemonType config.DaemonType, daemonID string,
daemonType, daemonID string,
) {
// #nosec because of the word `Secret`
keyringSecretName := fmt.Sprintf("rook-ceph-%s-%s-keyring", daemonType, daemonID)
@@ -117,7 +117,7 @@ func (ps *PodSpecTester) AssertRestartPolicyAlways() {
// AssertChownContainer ensures that the init container to chown the Ceph data dir is present for
// Ceph daemons.
func (ps *PodSpecTester) AssertChownContainer(daemonType config.DaemonType) {
func (ps *PodSpecTester) AssertChownContainer(daemonType string) {
switch daemonType {
case config.MonType, config.MgrType, config.OsdType, config.MdsType, config.RgwType, config.RbdMirrorType:
assert.True(ps.t, containerExists("chown-container-data-dir", ps.spec))
@@ -131,7 +131,7 @@ func (ps *PodSpecTester) AssertPriorityClassNameMatch(name string) {
// RunFullSuite runs all assertion tests for the PodSpec under test and its sub-resources.
func (ps *PodSpecTester) RunFullSuite(
daemonType config.DaemonType, resourceName, cephImage,
daemonType, resourceName, cephImage,
cpuResourceLimit, cpuResourceRequest, memoryResourceLimit, memoryResourceRequest string, priorityClassName string,
) {
resourceExpectations := optest.ResourceLimitExpectations{
+2 -4
View File
@@ -19,7 +19,6 @@ package test
import (
"testing"
"github.com/rook/rook/pkg/operator/ceph/config"
v1 "k8s.io/api/core/v1"
)
@@ -38,7 +37,7 @@ func NewPodTemplateSpecTester(t *testing.T, template *v1.PodTemplateSpec) *PodTe
// AssertLabelsContainCephRequirements asserts that the PodTemplateSpec under test contains labels
// which all Ceph pods should have.
func (pt *PodTemplateSpecTester) AssertLabelsContainCephRequirements(
daemonType config.DaemonType, daemonID, appName, namespace string,
daemonType, daemonID, appName, namespace string,
) {
AssertLabelsContainCephRequirements(pt.t, pt.template.ObjectMeta.Labels,
daemonType, daemonID, appName, namespace)
@@ -46,8 +45,7 @@ func (pt *PodTemplateSpecTester) AssertLabelsContainCephRequirements(
// RunFullSuite runs all assertion tests for the PodTemplateSpec under test and its sub-resources.
func (pt *PodTemplateSpecTester) RunFullSuite(
daemonType config.DaemonType,
daemonID, appName, namespace, cephImage,
daemonType, daemonID, appName, namespace, cephImage,
cpuResourceLimit, cpuResourceRequest,
memoryResourceLimit, memoryResourceRequest string,
priorityClassName string,
+1 -2
View File
@@ -22,7 +22,6 @@ import (
"testing"
e "github.com/pkg/errors"
"github.com/rook/rook/pkg/operator/ceph/config"
optest "github.com/rook/rook/pkg/operator/test"
"github.com/stretchr/testify/assert"
)
@@ -78,7 +77,7 @@ func VerifyPodLabels(appName, namespace, daemonType, daemonID string, labels map
// DaemonSets, etc.
func AssertLabelsContainCephRequirements(
t *testing.T, labels map[string]string,
daemonType config.DaemonType, daemonID, appName, namespace string,
daemonType, daemonID, appName, namespace string,
) {
optest.AssertLabelsContainRookRequirements(t, labels, appName)