forked from rook/rook
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:
@@ -506,7 +506,7 @@ func (c *daemonConfig) buildSocketPath() string {
|
||||
|
||||
func (c *daemonConfig) buildAdminSocketCommand() string {
|
||||
command := "status"
|
||||
if c.daemonType == string(config.MonType) {
|
||||
if c.daemonType == config.MonType {
|
||||
command = "mon_status"
|
||||
}
|
||||
|
||||
|
||||
@@ -104,44 +104,40 @@ func TestCheckPodMemory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBuildAdminSocketCommand(t *testing.T) {
|
||||
daemonType := string(config.OsdType)
|
||||
c := getDaemonConfig(daemonType, "")
|
||||
c := getDaemonConfig(config.OsdType, "")
|
||||
|
||||
command := c.buildAdminSocketCommand()
|
||||
assert.Equal(t, "status", command)
|
||||
|
||||
c.daemonType = string(config.MonType)
|
||||
c.daemonType = config.MonType
|
||||
command = c.buildAdminSocketCommand()
|
||||
assert.Equal(t, "mon_status", command)
|
||||
}
|
||||
|
||||
func TestBuildSocketName(t *testing.T) {
|
||||
daemonType := string(config.OsdType)
|
||||
daemonID := "0"
|
||||
c := getDaemonConfig(daemonType, daemonID)
|
||||
c := getDaemonConfig(config.OsdType, daemonID)
|
||||
|
||||
socketName := c.buildSocketName()
|
||||
assert.Equal(t, "ceph-osd.0.asok", socketName)
|
||||
|
||||
c.daemonType = string(config.MonType)
|
||||
c.daemonType = config.MonType
|
||||
c.daemonID = "a"
|
||||
socketName = c.buildSocketName()
|
||||
assert.Equal(t, "ceph-mon.a.asok", socketName)
|
||||
}
|
||||
|
||||
func TestBuildSocketPath(t *testing.T) {
|
||||
daemonType := string(config.OsdType)
|
||||
daemonID := "0"
|
||||
c := getDaemonConfig(daemonType, daemonID)
|
||||
c := getDaemonConfig(config.OsdType, daemonID)
|
||||
|
||||
socketPath := c.buildSocketPath()
|
||||
assert.Equal(t, "/run/ceph/ceph-osd.0.asok", socketPath)
|
||||
}
|
||||
|
||||
func TestGenerateLivenessProbeExecDaemon(t *testing.T) {
|
||||
daemonType := string(config.OsdType)
|
||||
daemonID := "0"
|
||||
probe := GenerateLivenessProbeExecDaemon(daemonType, daemonID)
|
||||
probe := GenerateLivenessProbeExecDaemon(config.OsdType, daemonID)
|
||||
expectedCommand := []string{"env",
|
||||
"-i",
|
||||
"sh",
|
||||
|
||||
Reference in New Issue
Block a user