FakeEtcdClient should return KeyNotFound on Delete

This commit is contained in:
Clayton Coleman
2015-03-04 22:34:16 -05:00
parent 143015025a
commit 4ca90e0343
3 changed files with 19 additions and 7 deletions

View File

@@ -283,7 +283,13 @@ func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, err
f.Mutex.Lock()
defer f.Mutex.Unlock()
existing := f.Data[key]
existing, ok := f.Data[key]
if !ok {
return &etcd.Response{}, &etcd.EtcdError{
ErrorCode: EtcdErrorCodeNotFound,
Index: f.ChangeIndex,
}
}
index := f.generateIndex()
f.Data[key] = EtcdResponseWithError{
R: &etcd.Response{},