From 0702164f05bb41e09c291ff92266db330facf894 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Sun, 20 Dec 2015 13:16:52 -0500 Subject: [PATCH] httplog is not a CloseNotifier We wrap TimeoutHandler with RecoverPanics, but httplog does not implement http.CloseNotifier, which causes a naive watch from curl against the insecure port to fail. For now, implement CloseNotifier (but we should consider removing httplog now that we have other tools in the stack to manage it). --- pkg/httplog/log.go | 5 +++++ test/integration/master_test.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/httplog/log.go b/pkg/httplog/log.go index 440c9e7b04ee7..2696019f0d174 100644 --- a/pkg/httplog/log.go +++ b/pkg/httplog/log.go @@ -200,6 +200,11 @@ func (rl *respLogger) Hijack() (net.Conn, *bufio.ReadWriter, error) { return rl.w.(http.Hijacker).Hijack() } +// CloseNotify implements http.CloseNotifier +func (rl *respLogger) CloseNotify() <-chan bool { + return rl.w.(http.CloseNotifier).CloseNotify() +} + func (rl *respLogger) recordStatus(status int) { rl.status = status rl.statusRecorded = true diff --git a/test/integration/master_test.go b/test/integration/master_test.go index 80c4c4ec5000b..cfd95db08c6e5 100644 --- a/test/integration/master_test.go +++ b/test/integration/master_test.go @@ -37,3 +37,17 @@ func TestExperimentalPrefix(t *testing.T) { t.Fatalf("got status %v instead of 200 OK", resp.StatusCode) } } + +func TestWatchSucceedsWithoutArgs(t *testing.T) { + _, s := framework.RunAMaster(t) + defer s.Close() + + resp, err := http.Get(s.URL + "/api/v1/namespaces?watch=1") + if err != nil { + t.Fatalf("unexpected error getting experimental prefix: %v", err) + } + if resp.StatusCode != http.StatusOK { + t.Fatalf("got status %v instead of 200 OK", resp.StatusCode) + } + resp.Body.Close() +}