Commit c2614aee authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #29500 from lixiaobing10051267/masterFound

Automatic merge from submit-queue Check all places to break the loop when object found Check all places to break the loop when object found.
parents df8da190 be8d0815
...@@ -389,6 +389,7 @@ func rulesMatch(expectedRules, actualRules []rbac.PolicyRule) bool { ...@@ -389,6 +389,7 @@ func rulesMatch(expectedRules, actualRules []rbac.PolicyRule) bool {
for _, actualRule := range actualRules { for _, actualRule := range actualRules {
if reflect.DeepEqual(expectedRule, actualRule) { if reflect.DeepEqual(expectedRule, actualRule) {
found = true found = true
break
} }
} }
......
...@@ -350,6 +350,7 @@ func (t *tracker) Delete(gvk unversioned.GroupVersionKind, ns, name string) erro ...@@ -350,6 +350,7 @@ func (t *tracker) Delete(gvk unversioned.GroupVersionKind, ns, name string) erro
if objMeta.GetNamespace() == ns && objMeta.GetName() == name { if objMeta.GetNamespace() == ns && objMeta.GetName() == name {
t.objects[gvk] = append(t.objects[gvk][:i], t.objects[gvk][i+1:]...) t.objects[gvk] = append(t.objects[gvk][:i], t.objects[gvk][i+1:]...)
found = true found = true
break
} }
} }
......
...@@ -219,6 +219,7 @@ func TestPetSetControllerBlocksScaling(t *testing.T) { ...@@ -219,6 +219,7 @@ func TestPetSetControllerBlocksScaling(t *testing.T) {
for _, p := range fc.getPodList() { for _, p := range fc.getPodList() {
if p.Name == deletedPod.Name { if p.Name == deletedPod.Name {
found = true found = true
break
} }
} }
if !found { if !found {
......
...@@ -445,6 +445,7 @@ func TestDirectoryBuilder(t *testing.T) { ...@@ -445,6 +445,7 @@ func TestDirectoryBuilder(t *testing.T) {
for _, info := range test.Infos { for _, info := range test.Infos {
if info.Name == "redis-master" && info.Namespace == "test" && info.Object != nil { if info.Name == "redis-master" && info.Namespace == "test" && info.Object != nil {
found = true found = true
break
} }
} }
if !found { if !found {
......
...@@ -624,6 +624,7 @@ func TestSyncPodCreateNetAndContainer(t *testing.T) { ...@@ -624,6 +624,7 @@ func TestSyncPodCreateNetAndContainer(t *testing.T) {
for _, c := range fakeDocker.RunningContainerList { for _, c := range fakeDocker.RunningContainerList {
if c.Image == "pod_infra_image" && strings.HasPrefix(c.Names[0], "/k8s_POD") { if c.Image == "pod_infra_image" && strings.HasPrefix(c.Names[0], "/k8s_POD") {
found = true found = true
break
} }
} }
if !found { if !found {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment