Skip to content

Commit

Permalink
backout
Browse files Browse the repository at this point in the history
  • Loading branch information
vdarulis committed Dec 2, 2020
1 parent 8548c51 commit 4228709
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
17 changes: 0 additions & 17 deletions src/aggregator/client/tcp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,6 @@ func (c *TCPClient) Close() error {
return c.writerMgr.Close()
}

// ActivePlacement returns a copy of the currently active placement and its version.
func (c *TCPClient) ActivePlacement() (placement.Placement, int, error) {
stagedPlacement, onStagedPlacementDoneFn, err := c.placementWatcher.ActiveStagedPlacement()
if err != nil {
return nil, 0, err
}
defer onStagedPlacementDoneFn()

placement, onPlacementDoneFn, err := stagedPlacement.ActivePlacement()
if err != nil {
return nil, 0, err
}
defer onPlacementDoneFn()

return placement.Clone(), stagedPlacement.Version(), nil
}

//nolint:gocritic
func (c *TCPClient) write(
metricID id.RawID,
Expand Down
25 changes: 0 additions & 25 deletions src/aggregator/client/tcp_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/m3db/m3/src/cluster/kv/mem"
Expand Down Expand Up @@ -793,30 +792,6 @@ func TestTCPClientInitAndClose(t *testing.T) {
require.NoError(t, c.Close())
}

func TestTCPClientActivePlacement(t *testing.T) {
var (
c = mustNewTestTCPClient(t, testOptions())
emptyPl = placement.NewPlacement()
ctrl = gomock.NewController(t)
mockPl = placement.NewMockPlacement(ctrl)
stagedPlacement = placement.NewMockActiveStagedPlacement(ctrl)
watcher = placement.NewMockStagedPlacementWatcher(ctrl)
doneCalls int
)

c.placementWatcher = watcher
watcher.EXPECT().ActiveStagedPlacement().Return(stagedPlacement, func() { doneCalls++ }, nil)
stagedPlacement.EXPECT().Version().Return(42)
stagedPlacement.EXPECT().ActivePlacement().Return(mockPl, func() { doneCalls++ }, nil)
mockPl.EXPECT().Clone().Return(emptyPl)

pl, v, err := c.ActivePlacement()
assert.NoError(t, err)
assert.Equal(t, 42, v)
assert.Equal(t, 2, doneCalls)
assert.Equal(t, emptyPl, pl)
}

func mustNewTestTCPClient(t *testing.T, opts Options) *TCPClient {
c, err := NewClient(opts)
require.NoError(t, err)
Expand Down

0 comments on commit 4228709

Please sign in to comment.