From 3a253f796cd244e0c4c29fe1ef0f820bfef09428 Mon Sep 17 00:00:00 2001 From: Yecheng Fu Date: Tue, 10 Apr 2018 16:44:24 +0800 Subject: [PATCH] Fix grammar in comments and add missing `expectedMaxItems` to let it break fast. Signed-off-by: Yecheng Fu --- discovery/kubernetes/kubernetes_test.go | 5 +++-- discovery/kubernetes/pod_test.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/discovery/kubernetes/kubernetes_test.go b/discovery/kubernetes/kubernetes_test.go index 6e5ad3619..aea7a883e 100644 --- a/discovery/kubernetes/kubernetes_test.go +++ b/discovery/kubernetes/kubernetes_test.go @@ -189,8 +189,9 @@ func requireTargetGroups(t *testing.T, expected, res map[string]*targetgroup.Gro } type hasSynced interface { - // hasSynced returns true if all informers' store has synced. - // This is only used in testing to determine when the cache stores have synced. + // hasSynced returns true if all informers synced. + // This is only used in testing to determine when discoverer synced to + // kubernetes apiserver. hasSynced() bool } diff --git a/discovery/kubernetes/pod_test.go b/discovery/kubernetes/pod_test.go index 3023db4ec..38fd1f814 100644 --- a/discovery/kubernetes/pod_test.go +++ b/discovery/kubernetes/pod_test.go @@ -163,6 +163,7 @@ func TestPodDiscoveryAdd(t *testing.T) { c.CoreV1().Pods(obj.Namespace).Create(obj) w.Pods().Add(obj) }, + expectedMaxItems: 1, expectedRes: map[string]*targetgroup.Group{ "pod/default/testpod": { Targets: []model.LabelSet{ @@ -200,6 +201,7 @@ func TestPodDiscoveryDelete(t *testing.T) { c.CoreV1().Pods(obj.Namespace).Delete(obj.Name, &metav1.DeleteOptions{}) w.Pods().Delete(obj) }, + expectedMaxItems: 2, expectedRes: map[string]*targetgroup.Group{ "pod/default/testpod": { Source: "pod/default/testpod", @@ -244,6 +246,7 @@ func TestPodDiscoveryUpdate(t *testing.T) { c.CoreV1().Pods(obj.Namespace).Create(obj) w.Pods().Modify(obj) }, + expectedMaxItems: 2, expectedRes: map[string]*targetgroup.Group{ "pod/default/testpod": { Targets: []model.LabelSet{