make watch actually return an error when there's an error

This commit is contained in:
Daniel Smith
2014-09-19 17:53:55 -07:00
parent 334f9dc772
commit 0d69393a43
3 changed files with 48 additions and 12 deletions

View File

@@ -198,6 +198,19 @@ func TestWatchInterpretation_ResponseBadData(t *testing.T) {
}
}
func TestWatchEtcdError(t *testing.T) {
codec := latest.Codec
fakeClient := NewFakeEtcdClient(t)
fakeClient.expectNotFoundGetSet["/some/key"] = struct{}{}
fakeClient.WatchImmediateError = fmt.Errorf("immediate error")
h := EtcdHelper{fakeClient, codec, versioner}
_, err := h.Watch("/some/key", 0)
if err == nil {
t.Fatalf("Unexpected non-error")
}
}
func TestWatch(t *testing.T) {
codec := latest.Codec
fakeClient := NewFakeEtcdClient(t)