Skip to content

Commit

Permalink
microceph/ceph: Update cluster remove test
Browse files Browse the repository at this point in the history
Moves the removeNode test over to the `ceph` package, and removes the
`DeleteClusterMember` expected calls as this function no longer manages
that.

Signed-off-by: Max Asnaashari <[email protected]>
  • Loading branch information
masnax committed Jul 5, 2024
1 parent 25fefb0 commit 9266ea6
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package main
package ceph

import (
"testing"

"github.com/canonical/microceph/microceph/api/types"
"github.com/canonical/microceph/microceph/client"
"github.com/canonical/microceph/microceph/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"testing"

"github.com/stretchr/testify/suite"
)
Expand Down Expand Up @@ -46,7 +47,6 @@ func (s *clusterRemoveSuite) TestRemoveNode() {
nil,
)
m.On("DeleteService", mock.Anything, "foonode", "mon").Return(nil).Once()
m.On("DeleteClusterMember", mock.Anything, "foonode", false).Return(nil).Once()

err := removeNode(nil, "foonode", false)

Expand All @@ -68,9 +68,6 @@ func (s *clusterRemoveSuite) TestRemoveNodeWithDisks() {
err := removeNode(nil, "foonode", false)

assert.Error(s.T(), err)

// assert that we didn't try to delete the node
m.AssertNotCalled(s.T(), "DeleteClusterMember", mock.Anything, "foonode", false)
}

// TestRemoveNodeLastMon tests that we don't try to delete a node that has the last mon
Expand All @@ -93,9 +90,6 @@ func (s *clusterRemoveSuite) TestRemoveNodeLastMon() {
err := removeNode(nil, "foonode", false)

assert.Error(s.T(), err)

// assert that we didn't try to delete the node
m.AssertNotCalled(s.T(), "DeleteClusterMember", mock.Anything, "foonode", false)
}

// TestRemoveNodeForce tests that we don't check prerequisites and delete a node if forced
Expand All @@ -114,7 +108,6 @@ func (s *clusterRemoveSuite) TestRemoveNodeForce() {
nil,
)
m.On("DeleteService", mock.Anything, "foonode", "mon").Return(nil).Once()
m.On("DeleteClusterMember", mock.Anything, "foonode", true).Return(nil).Once()

err := removeNode(nil, "foonode", true)

Expand Down

0 comments on commit 9266ea6

Please sign in to comment.