mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #3289 from yichengq/marshal
etcdserver: go back to marshal request in 2.1 way
This commit is contained in:
commit
a17288558e
@ -529,9 +529,7 @@ func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {
|
|||||||
}
|
}
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "POST", "PUT", "DELETE", "QGET":
|
case "POST", "PUT", "DELETE", "QGET":
|
||||||
var raftReq pb.InternalRaftRequest
|
data, err := r.Marshal()
|
||||||
raftReq.V2 = &r
|
|
||||||
data, err := raftReq.Marshal()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Response{}, err
|
return Response{}, err
|
||||||
}
|
}
|
||||||
|
@ -989,11 +989,10 @@ func TestPublish(t *testing.T) {
|
|||||||
t.Fatalf("action = %s, want Propose", action[0].Name)
|
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||||
}
|
}
|
||||||
data := action[0].Params[0].([]byte)
|
data := action[0].Params[0].([]byte)
|
||||||
var rr pb.InternalRaftRequest
|
var r pb.Request
|
||||||
if err := rr.Unmarshal(data); err != nil {
|
if err := r.Unmarshal(data); err != nil {
|
||||||
t.Fatalf("unmarshal request error: %v", err)
|
t.Fatalf("unmarshal request error: %v", err)
|
||||||
}
|
}
|
||||||
r := rr.V2
|
|
||||||
if r.Method != "PUT" {
|
if r.Method != "PUT" {
|
||||||
t.Errorf("method = %s, want PUT", r.Method)
|
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)
|
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||||
}
|
}
|
||||||
data := action[0].Params[0].([]byte)
|
data := action[0].Params[0].([]byte)
|
||||||
var rr pb.InternalRaftRequest
|
var r pb.Request
|
||||||
if err := rr.Unmarshal(data); err != nil {
|
if err := r.Unmarshal(data); err != nil {
|
||||||
t.Fatalf("unmarshal request error: %v", err)
|
t.Fatalf("unmarshal request error: %v", err)
|
||||||
}
|
}
|
||||||
r := rr.V2
|
|
||||||
if r.Method != "PUT" {
|
if r.Method != "PUT" {
|
||||||
t.Errorf("method = %s, want PUT", r.Method)
|
t.Errorf("method = %s, want PUT", r.Method)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user