etcdserver: parse context error for better message
This commit is contained in:
@ -614,8 +614,8 @@ func TestDoProposalCancelled(t *testing.T) {
|
||||
if len(gaction) != 0 {
|
||||
t.Errorf("len(action) = %v, want 0", len(gaction))
|
||||
}
|
||||
if err != context.Canceled {
|
||||
t.Fatalf("err = %v, want %v", err, context.Canceled)
|
||||
if err != ErrCanceled {
|
||||
t.Fatalf("err = %v, want %v", err, ErrCanceled)
|
||||
}
|
||||
w := []action{action{name: "Register1"}, action{name: "Trigger1"}}
|
||||
if !reflect.DeepEqual(wait.action, w) {
|
||||
@ -623,6 +623,18 @@ func TestDoProposalCancelled(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDoProposalTimeout(t *testing.T) {
|
||||
ctx, _ := context.WithTimeout(context.Background(), 0)
|
||||
srv := &EtcdServer{
|
||||
node: &nodeRecorder{},
|
||||
w: &waitRecorder{},
|
||||
}
|
||||
_, err := srv.Do(ctx, pb.Request{Method: "PUT", ID: 1})
|
||||
if err != ErrTimeout {
|
||||
t.Fatalf("err = %v, want %v", err, ErrTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDoProposalStopped(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
Reference in New Issue
Block a user