diff --git a/rados/command_mimic_test.go b/rados/command_mimic_test.go deleted file mode 100644 index 29a06cd..0000000 --- a/rados/command_mimic_test.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build !luminous -// +build !luminous - -package rados - -import ( - "encoding/json" - - "github.com/stretchr/testify/assert" -) - -// A real test using input buffer is hard to find for mgr. -// The simplest does not work on luminous, so we simply don't -// provide the test for luminous. - -func (suite *RadosTestSuite) TestMgrCommandWithInputBuffer() { - suite.SetupConnection() - - command, err := json.Marshal( - map[string]string{"prefix": "crash post", "format": "json"}) - assert.NoError(suite.T(), err) - - buf, info, err := suite.conn.MgrCommandWithInputBuffer( - [][]byte{command}, []byte(`{"crash_id": "foobar", "timestamp": "2020-04-10 15:08:34.659679Z"}`)) - assert.NoError(suite.T(), err) - assert.Equal(suite.T(), info, "") - assert.Len(suite.T(), buf, 0) - - command, err = json.Marshal( - map[string]string{"prefix": "crash rm", "id": "foobar", "format": "json"}) - assert.NoError(suite.T(), err) - - buf, info, err = suite.conn.MgrCommandWithInputBuffer( - [][]byte{command}, nil) - assert.NoError(suite.T(), err) - assert.Equal(suite.T(), info, "") - assert.Len(suite.T(), buf, 0) -} diff --git a/rados/command_test.go b/rados/command_test.go index 92d3efe..3bb5369 100644 --- a/rados/command_test.go +++ b/rados/command_test.go @@ -218,3 +218,28 @@ func (suite *RadosTestSuite) TestMonCommandTargetMalformedCommand() { assert.NotEqual(suite.T(), info, "") assert.Len(suite.T(), buf, 0) } + +// Does not work on ceph luminous, but we do not support ceph luminous. +func (suite *RadosTestSuite) TestMgrCommandWithInputBuffer() { + suite.SetupConnection() + + command, err := json.Marshal( + map[string]string{"prefix": "crash post", "format": "json"}) + assert.NoError(suite.T(), err) + + buf, info, err := suite.conn.MgrCommandWithInputBuffer( + [][]byte{command}, []byte(`{"crash_id": "foobar", "timestamp": "2020-04-10 15:08:34.659679Z"}`)) + assert.NoError(suite.T(), err) + assert.Equal(suite.T(), info, "") + assert.Len(suite.T(), buf, 0) + + command, err = json.Marshal( + map[string]string{"prefix": "crash rm", "id": "foobar", "format": "json"}) + assert.NoError(suite.T(), err) + + buf, info, err = suite.conn.MgrCommandWithInputBuffer( + [][]byte{command}, nil) + assert.NoError(suite.T(), err) + assert.Equal(suite.T(), info, "") + assert.Len(suite.T(), buf, 0) +}