Merge pull request #3289 from yichengq/marshal

etcdserver: go back to marshal request in 2.1 way
This commit is contained in:
Yicheng Qin 2015-08-13 14:20:24 -07:00
commit a17288558e
2 changed files with 5 additions and 9 deletions

View File

@ -529,9 +529,7 @@ func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {
}
switch r.Method {
case "POST", "PUT", "DELETE", "QGET":
var raftReq pb.InternalRaftRequest
raftReq.V2 = &r
data, err := raftReq.Marshal()
data, err := r.Marshal()
if err != nil {
return Response{}, err
}

View File

@ -989,11 +989,10 @@ func TestPublish(t *testing.T) {
t.Fatalf("action = %s, want Propose", action[0].Name)
}
data := action[0].Params[0].([]byte)
var rr pb.InternalRaftRequest
if err := rr.Unmarshal(data); err != nil {
var r pb.Request
if err := r.Unmarshal(data); err != nil {
t.Fatalf("unmarshal request error: %v", err)
}
r := rr.V2
if r.Method != "PUT" {
t.Errorf("method = %s, want PUT", r.Method)
}
@ -1073,11 +1072,10 @@ func TestUpdateVersion(t *testing.T) {
t.Fatalf("action = %s, want Propose", action[0].Name)
}
data := action[0].Params[0].([]byte)
var rr pb.InternalRaftRequest
if err := rr.Unmarshal(data); err != nil {
var r pb.Request
if err := r.Unmarshal(data); err != nil {
t.Fatalf("unmarshal request error: %v", err)
}
r := rr.V2
if r.Method != "PUT" {
t.Errorf("method = %s, want PUT", r.Method)
}