From 5985d410ce041236be10cc9d7f1d8dc61447627e Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 1 Nov 2021 10:03:01 -0400 Subject: [PATCH] rados: merge test case into standard tests file, removing luminous tag We no longer support ceph luminous, and have not for a while. This test case was kept separately from the others because it didn't function correctly when tested against luminous clusters. As part of the effort to remove the unsupported build tags, there's no longer even a reason to keep this as it's own file with the tags removed, so merge it together. Signed-off-by: John Mulligan --- rados/command_mimic_test.go | 38 ------------------------------------- rados/command_test.go | 25 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 38 deletions(-) delete mode 100644 rados/command_mimic_test.go 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) +}