Browse Source

Merge pull request #1860 from yichengq/249

integration: fix possible early fire in TestWatch
Yicheng Qin 11 years ago
parent
commit
ca32a5fe9b
1 changed files with 1 additions and 15 deletions
  1. 1 15
      integration/v2_http_kv_test.go

+ 1 - 15
integration/v2_http_kv_test.go

@@ -770,15 +770,7 @@ func TestV2Watch(t *testing.T) {
 	u := cl.URL(0)
 	tc := NewTestClient()
 
-	var watchResp *http.Response
-	c := make(chan bool)
-	go func() {
-		watchResp, _ = tc.Get(fmt.Sprintf("%s%s", u, "/v2/keys/foo/bar?wait=true"))
-		c <- true
-	}()
-
-	// Make sure response didn't fire early.
-	time.Sleep(1 * time.Millisecond)
+	watchResp, _ := tc.Get(fmt.Sprintf("%s%s", u, "/v2/keys/foo/bar?wait=true"))
 
 	// Set a value.
 	v := url.Values{}
@@ -786,12 +778,6 @@ func TestV2Watch(t *testing.T) {
 	resp, _ := tc.PutForm(fmt.Sprintf("%s%s", u, "/v2/keys/foo/bar"), v)
 	resp.Body.Close()
 
-	select {
-	case <-c:
-	case <-time.After(time.Millisecond):
-		t.Fatal("cannot get watch result")
-	}
-
 	body := tc.ReadBodyJSON(watchResp)
 	w := map[string]interface{}{
 		"node": map[string]interface{}{