mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Merge pull request #18999 from wojtek-t/close_watchers
Close watchers in tests
This commit is contained in:
commit
6ac2774dea
@ -605,6 +605,7 @@ func TestEtcdWatch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wi.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
server.Terminate(t)
|
server.Terminate(t)
|
||||||
|
@ -246,6 +246,7 @@ func TestWatch(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
defer watching.Stop()
|
||||||
|
|
||||||
// Test normal case
|
// Test normal case
|
||||||
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
||||||
@ -292,6 +293,7 @@ func TestWatchEtcdState(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
defer watching.Stop()
|
||||||
|
|
||||||
endpoint := &api.Endpoints{
|
endpoint := &api.Endpoints{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
@ -356,6 +358,7 @@ func TestWatchFromZeroIndex(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
defer watching.Stop()
|
||||||
|
|
||||||
// marked as modified b/c of concatenation
|
// marked as modified b/c of concatenation
|
||||||
event := <-watching.ResultChan()
|
event := <-watching.ResultChan()
|
||||||
@ -391,6 +394,7 @@ func TestWatchListFromZeroIndex(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
defer watching.Stop()
|
||||||
|
|
||||||
// creates key/foo which should trigger the WatchList for "key"
|
// creates key/foo which should trigger the WatchList for "key"
|
||||||
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}}
|
||||||
@ -423,6 +427,7 @@ func TestWatchListIgnoresRootKey(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
defer watching.Stop()
|
||||||
|
|
||||||
// creates key/foo which should trigger the WatchList for "key"
|
// creates key/foo which should trigger the WatchList for "key"
|
||||||
err = h.Create(context.TODO(), key, pod, pod, 0)
|
err = h.Create(context.TODO(), key, pod, pod, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user