Pass Context to StartTestServer

Signed-off-by: Kante Yin <kerthcet@gmail.com>
This commit is contained in:
Kante Yin
2023-03-31 12:19:26 +08:00
committed by kerthcet
parent 2d866ec2fc
commit a7035f5459
42 changed files with 754 additions and 473 deletions

View File

@@ -480,11 +480,12 @@ func TestDeleteFinalStateUnknown(t *testing.T) {
}
func TestExpectationsOnRecreate(t *testing.T) {
client := fake.NewSimpleClientset()
stopCh := make(chan struct{})
defer close(stopCh)
_, ctx := ktesting.NewTestContext(t)
ctx, cancel := context.WithCancel(ctx)
defer cancel()
client := fake.NewSimpleClientset()
f := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc())
dsc, err := NewDaemonSetsController(
ctx,
@@ -550,8 +551,8 @@ func TestExpectationsOnRecreate(t *testing.T) {
t.Fatal(err)
}
f.Start(stopCh)
for ty, ok := range f.WaitForCacheSync(stopCh) {
f.Start(ctx.Done())
for ty, ok := range f.WaitForCacheSync(ctx.Done()) {
if !ok {
t.Fatalf("caches failed to sync: %v", ty)
}