mirror of
https://github.com/ceph/go-ceph
synced 2025-02-05 04:52:01 +00:00
rados: test functions for MonCommandTarget
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
665611d054
commit
861747663b
@ -10,6 +10,7 @@ import (
|
||||
|
||||
var (
|
||||
osdNumber = 0
|
||||
monName = "a"
|
||||
)
|
||||
|
||||
func (suite *RadosTestSuite) TestMonCommand() {
|
||||
@ -175,3 +176,45 @@ func (suite *RadosTestSuite) TestOsdCommandMalformedCommand() {
|
||||
assert.NotEqual(suite.T(), info, "")
|
||||
assert.Len(suite.T(), buf, 0)
|
||||
}
|
||||
|
||||
func (suite *RadosTestSuite) TestMonCommandTargetDescriptions() {
|
||||
suite.SetupConnection()
|
||||
|
||||
command, err := json.Marshal(
|
||||
map[string]string{"prefix": "get_command_descriptions", "format": "json"})
|
||||
assert.NoError(suite.T(), err)
|
||||
|
||||
buf, info, err := suite.conn.MonCommandTarget(monName, [][]byte{command})
|
||||
assert.NoError(suite.T(), err)
|
||||
assert.Equal(suite.T(), info, "")
|
||||
|
||||
var message map[string]interface{}
|
||||
err = json.Unmarshal(buf, &message)
|
||||
assert.NoError(suite.T(), err)
|
||||
}
|
||||
|
||||
func (suite *RadosTestSuite) TestMonCommandTarget() {
|
||||
suite.SetupConnection()
|
||||
|
||||
command, err := json.Marshal(
|
||||
map[string]string{"prefix": "mon_status"})
|
||||
assert.NoError(suite.T(), err)
|
||||
|
||||
buf, info, err := suite.conn.MonCommandTarget(monName, [][]byte{command})
|
||||
assert.NoError(suite.T(), err)
|
||||
assert.Equal(suite.T(), info, "")
|
||||
|
||||
var message map[string]interface{}
|
||||
err = json.Unmarshal(buf, &message)
|
||||
assert.NoError(suite.T(), err)
|
||||
}
|
||||
|
||||
func (suite *RadosTestSuite) TestMonCommandTargetMalformedCommand() {
|
||||
suite.SetupConnection()
|
||||
|
||||
command := []byte("JUNK!")
|
||||
buf, info, err := suite.conn.MonCommandTarget(monName, [][]byte{command})
|
||||
assert.Error(suite.T(), err)
|
||||
assert.NotEqual(suite.T(), info, "")
|
||||
assert.Len(suite.T(), buf, 0)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user