mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Check all places to break the loop when object found
This commit is contained in:
		@@ -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
 | 
				
			|||||||
		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) {
 | 
				
			|||||||
	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) {
 | 
				
			|||||||
	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 {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -613,6 +613,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 {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user