Skip to content

Commit

Permalink
storage: Deflake TestReplicateRogueRemovedNode
Browse files Browse the repository at this point in the history
Some recently-refactored test harness code needed to check for nil
stores.

Fixes cockroachdb#41466

Release note: None
  • Loading branch information
bdarnell committed Oct 16, 2019
1 parent 705f9e6 commit 0b9198b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkg/storage/client_raft_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,31 @@ func (h *mtcStoreRaftMessageHandler) HandleRaftRequest(
req *storage.RaftMessageRequest,
respStream storage.RaftMessageResponseStream,
) *roachpb.Error {
return h.mtc.Store(h.storeIdx).HandleRaftRequest(ctx, req, respStream)
store := h.mtc.Store(h.storeIdx)
if store == nil {
return roachpb.NewErrorf("store not found")
}
return store.HandleRaftRequest(ctx, req, respStream)
}

func (h *mtcStoreRaftMessageHandler) HandleRaftResponse(
ctx context.Context, resp *storage.RaftMessageResponse,
) error {
return h.mtc.Store(h.storeIdx).HandleRaftResponse(ctx, resp)
store := h.mtc.Store(h.storeIdx)
if store == nil {
return errors.New("store not found")
}
return store.HandleRaftResponse(ctx, resp)
}

func (h *mtcStoreRaftMessageHandler) HandleSnapshot(
header *storage.SnapshotRequest_Header, respStream storage.SnapshotResponseStream,
) error {
return h.mtc.Store(h.storeIdx).HandleSnapshot(header, respStream)
store := h.mtc.Store(h.storeIdx)
if store == nil {
return errors.New("store not found")
}
return store.HandleSnapshot(header, respStream)
}

// mtcPartitionedRange is a convenient abstraction to create a range on a node
Expand Down

0 comments on commit 0b9198b

Please sign in to comment.