Add test timeout to mutation detector test

Kubernetes-commit: 877d889ac2c78b1c8c94dc2839351aad4136f908
This commit is contained in:
Jordan Liggitt 2021-03-06 18:16:42 -05:00 committed by Kubernetes Publisher
parent 8df02b312c
commit 21ee617309

View File

@ -49,8 +49,9 @@ func TestMutationDetector(t *testing.T) {
informer := NewSharedInformer(lw, &v1.Pod{}, 1*time.Second).(*sharedIndexInformer) informer := NewSharedInformer(lw, &v1.Pod{}, 1*time.Second).(*sharedIndexInformer)
detector := &defaultCacheMutationDetector{ detector := &defaultCacheMutationDetector{
name: "name", name: "name",
period: 1 * time.Second, period: 1 * time.Second,
retainDuration: 2 * time.Minute,
failureFunc: func(message string) { failureFunc: func(message string) {
mutationFound <- true mutationFound <- true
}, },
@ -72,6 +73,8 @@ func TestMutationDetector(t *testing.T) {
select { select {
case <-mutationFound: case <-mutationFound:
case <-time.After(wait.ForeverTestTimeout):
t.Fatalf("failed waiting for mutating detector")
} }
} }