mirror of https://github.com/docker/docs.git
Add timeouts for watch tests
Signed-off-by: Alexandre Beslic <abronan@docker.com>
This commit is contained in:
parent
18cfe74d5b
commit
4b53c92081
|
@ -88,6 +88,8 @@ func TestConsulWatch(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -105,7 +107,8 @@ func TestConsulWatch(t *testing.T) {
|
|||
if eventCount >= 4 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +161,7 @@ func TestConsulWatchTree(t *testing.T) {
|
|||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -169,7 +173,8 @@ func TestConsulWatchTree(t *testing.T) {
|
|||
if eventCount >= 4 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ func TestEtcdWatch(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -106,7 +108,8 @@ func TestEtcdWatch(t *testing.T) {
|
|||
if eventCount >= 4 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +163,7 @@ func TestEtcdWatchTree(t *testing.T) {
|
|||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -171,7 +175,8 @@ func TestEtcdWatchTree(t *testing.T) {
|
|||
if eventCount >= 4 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,8 @@ func TestZkWatch(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -105,7 +107,8 @@ func TestZkWatch(t *testing.T) {
|
|||
if eventCount >= 4 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +165,7 @@ func TestZkWatchTree(t *testing.T) {
|
|||
}()
|
||||
|
||||
// Check for updates
|
||||
timeout := time.After(2 * time.Second)
|
||||
eventCount := 1
|
||||
for {
|
||||
select {
|
||||
|
@ -172,7 +176,8 @@ func TestZkWatchTree(t *testing.T) {
|
|||
if eventCount >= 3 {
|
||||
return
|
||||
}
|
||||
case <-stopCh:
|
||||
case <-timeout:
|
||||
t.Fatal("Timeout reached")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue