Close watchers in tests

This commit is contained in:
Wojciech Tyczynski
2015-12-22 09:54:05 +01:00
parent 0cdd2abada
commit 2b8854ba28
2 changed files with 6 additions and 0 deletions

View File

@@ -605,6 +605,7 @@ func TestEtcdWatch(t *testing.T) {
}
}
}
wi.Stop()
}
server.Terminate(t)

View File

@@ -246,6 +246,7 @@ func TestWatch(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
defer watching.Stop()
// Test normal case
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
@@ -292,6 +293,7 @@ func TestWatchEtcdState(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
defer watching.Stop()
endpoint := &api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: "foo"},
@@ -356,6 +358,7 @@ func TestWatchFromZeroIndex(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
defer watching.Stop()
// marked as modified b/c of concatenation
event := <-watching.ResultChan()
@@ -391,6 +394,7 @@ func TestWatchListFromZeroIndex(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
defer watching.Stop()
// creates key/foo which should trigger the WatchList for "key"
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
@@ -423,6 +427,7 @@ func TestWatchListIgnoresRootKey(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
defer watching.Stop()
// creates key/foo which should trigger the WatchList for "key"
err = h.Create(context.TODO(), key, pod, pod, 0)