mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1860 from yichengq/249
integration: fix possible early fire in TestWatch
This commit is contained in:
commit
ca32a5fe9b
@ -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{}{
|
||||
|
Loading…
x
Reference in New Issue
Block a user