Skip to content

Commit

Permalink
Merge pull request #1710 from tamird/return-replies-2
Browse files Browse the repository at this point in the history
Return (response, error) #2
  • Loading branch information
tamird committed Jul 17, 2015
2 parents acbcbbe + 140d855 commit 6efcb06
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 158 deletions.
10 changes: 4 additions & 6 deletions storage/client_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package storage_test
import (
"bytes"
"reflect"
"strings"
"testing"

"golang.org/x/net/context"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/cockroachdb/cockroach/proto"
"github.com/cockroachdb/cockroach/storage"
"github.com/cockroachdb/cockroach/storage/engine"
"github.com/cockroachdb/cockroach/testutils"
"github.com/cockroachdb/cockroach/util/leaktest"
"github.com/cockroachdb/cockroach/util/log"
)
Expand Down Expand Up @@ -253,11 +253,9 @@ func TestStoreRangeMergeNonConsecutive(t *testing.T) {
t.Fatal(err)
}

argsMerge, replyMerge := adminMergeArgs(rangeA.Desc().StartKey, 1, store.StoreID())
rangeA.AdminMerge(argsMerge, replyMerge)
if replyMerge.Error == nil ||
!strings.Contains(replyMerge.Error.Error(), "ranges not collocated") {
t.Fatalf("did not got expected error; got %s", replyMerge.Error)
argsMerge, _ := adminMergeArgs(rangeA.Desc().StartKey, 1, store.StoreID())
if _, err := rangeA.AdminMerge(argsMerge); !testutils.IsError(err, "ranges not collocated") {
t.Fatalf("did not got expected error; got %s", err)
}

// Re-add the range. This is necessary for a clean shutdown.
Expand Down
15 changes: 6 additions & 9 deletions storage/client_raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,10 @@ func TestRangeDescriptorSnapshotRace(t *testing.T) {
if rng == nil {
t.Fatal("failed to look up min range")
}
args, reply := adminSplitArgs(proto.KeyMin, []byte(fmt.Sprintf("A%03d", i)), rng.Desc().RaftID,
args, _ := adminSplitArgs(proto.KeyMin, []byte(fmt.Sprintf("A%03d", i)), rng.Desc().RaftID,
mtc.stores[0].StoreID())
rng.AdminSplit(args, reply)
if reply.GoError() != nil {
t.Fatal(reply.GoError())
if _, err := rng.AdminSplit(args); err != nil {
t.Fatal(err)
}
}

Expand All @@ -802,11 +801,9 @@ func TestRangeDescriptorSnapshotRace(t *testing.T) {
if rng == nil {
t.Fatal("failed to look up max range")
}
args, reply := adminSplitArgs(proto.KeyMin, []byte(fmt.Sprintf("B%03d", i)), rng.Desc().RaftID,
mtc.stores[0].StoreID())
rng.AdminSplit(args, reply)
if reply.GoError() != nil {
t.Fatal(reply.GoError())
args, _ := adminSplitArgs(proto.KeyMin, []byte(fmt.Sprintf("B%03d", i)), rng.Desc().RaftID, mtc.stores[0].StoreID())
if _, err := rng.AdminSplit(args); err != nil {
t.Fatal(err)
}
}
}
Loading

0 comments on commit 6efcb06

Please sign in to comment.