Simplified k8s API Body watcher code and test. (#923)

This commit is contained in:
Milos Gajdos
2019-11-08 15:57:32 +00:00
committed by Asim Aslam
parent 1ffa289d39
commit 0b1e6d7eaf
2 changed files with 18 additions and 38 deletions

View File

@@ -37,17 +37,15 @@ func TestBodyWatcher(t *testing.T) {
req, err := http.NewRequest("GET", ts.URL, nil)
if err != nil {
t.Fatalf("did not expect NewRequest to return err: %v", err)
t.Fatalf("failed to create new request: %v", err)
}
// setup body watcher
w, err := NewBodyWatcher(req, http.DefaultClient)
if err != nil {
t.Fatalf("did not expect NewBodyWatcher to return %v", err)
t.Fatalf("failed to create new BodyWatcher %v", err)
}
<-time.After(time.Second)
// send action strings in, and expect result back
ch <- actions[0]
if r := <-w.ResultChan(); r.Type != "create" {