When connections are broken on Watch, write fewer errors to logs

Watch depends on long running connections, which intervening proxies
may break without the control of the remote server. Specific errors
handled are io.EOF, io.EOF wrapped by *url.Error, http connection
reset errors (caused by race conditions in golang http code), and
connection reset by peer (simply tolerated).
This commit is contained in:
Clayton Coleman
2014-12-18 15:38:24 -05:00
parent af571a239e
commit b2434de777
5 changed files with 103 additions and 1 deletions

View File

@@ -70,3 +70,16 @@ func TestFake(t *testing.T) {
go sender()
consumer(f)
}
func TestEmpty(t *testing.T) {
w := NewEmptyWatch()
_, ok := <-w.ResultChan()
if ok {
t.Errorf("unexpected result channel result")
}
w.Stop()
_, ok = <-w.ResultChan()
if ok {
t.Errorf("unexpected result channel result")
}
}