clientv3: convert errors to rpctypes on returning

For https://github.com/coreos/etcd/issues/5211.
This commit is contained in:
Gyu-Ho Lee
2016-04-28 12:17:41 -07:00
parent f613052435
commit 2e3d79a7bf
8 changed files with 64 additions and 59 deletions

View File

@ -55,16 +55,16 @@ func TestDialTimeout(t *testing.T) {
}
}
func TestIsHalted(t *testing.T) {
if !isHalted(nil, fmt.Errorf("etcdserver: some etcdserver error")) {
func TestIsHaltErr(t *testing.T) {
if !isHaltErr(nil, fmt.Errorf("etcdserver: some etcdserver error")) {
t.Errorf(`error prefixed with "etcdserver: " should be Halted`)
}
ctx, cancel := context.WithCancel(context.TODO())
if isHalted(ctx, nil) {
if isHaltErr(ctx, nil) {
t.Errorf("no error and active context should not be Halted")
}
cancel()
if !isHalted(ctx, nil) {
if !isHaltErr(ctx, nil) {
t.Errorf("cancel on context should be Halted")
}
}