mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	reduce garbage_collector test cases running time
This commit is contained in:
		@@ -377,12 +377,12 @@ func TestCascadingDeletion(t *testing.T) {
 | 
				
			|||||||
	// sometimes the deletion of the RC takes long time to be observed by
 | 
						// sometimes the deletion of the RC takes long time to be observed by
 | 
				
			||||||
	// the gc, so wait for the garbage collector to observe the deletion of
 | 
						// the gc, so wait for the garbage collector to observe the deletion of
 | 
				
			||||||
	// the toBeDeletedRC
 | 
						// the toBeDeletedRC
 | 
				
			||||||
	if err := wait.Poll(10*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		return !gc.GraphHasUID([]types.UID{toBeDeletedRC.ObjectMeta.UID}), nil
 | 
							return !gc.GraphHasUID([]types.UID{toBeDeletedRC.ObjectMeta.UID}), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 5*time.Second, 30*time.Second); err != nil {
 | 
						if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 1*time.Second, 30*time.Second); err != nil {
 | 
				
			||||||
		t.Fatalf("expect pod %s to be garbage collected, got err= %v", garbageCollectedPodName, err)
 | 
							t.Fatalf("expect pod %s to be garbage collected, got err= %v", garbageCollectedPodName, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// checks the garbage collect doesn't delete pods it shouldn't delete.
 | 
						// checks the garbage collect doesn't delete pods it shouldn't delete.
 | 
				
			||||||
@@ -422,7 +422,7 @@ func TestCreateWithNonExistentOwner(t *testing.T) {
 | 
				
			|||||||
		t.Fatalf("Unexpected pod list: %v", pods.Items)
 | 
							t.Fatalf("Unexpected pod list: %v", pods.Items)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// wait for the garbage collector to delete the pod
 | 
						// wait for the garbage collector to delete the pod
 | 
				
			||||||
	if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 5*time.Second, 30*time.Second); err != nil {
 | 
						if err := integration.WaitForPodToDisappear(podClient, garbageCollectedPodName, 1*time.Second, 30*time.Second); err != nil {
 | 
				
			||||||
		t.Fatalf("expect pod %s to be garbage collected, got err= %v", garbageCollectedPodName, err)
 | 
							t.Fatalf("expect pod %s to be garbage collected, got err= %v", garbageCollectedPodName, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -456,7 +456,7 @@ func setupRCsPods(t *testing.T, gc *garbagecollector.GarbageCollector, clientSet
 | 
				
			|||||||
	// creation of the pods, otherwise if the deletion of RC is observed before
 | 
						// creation of the pods, otherwise if the deletion of RC is observed before
 | 
				
			||||||
	// the creation of the pods, the pods will not be orphaned.
 | 
						// the creation of the pods, the pods will not be orphaned.
 | 
				
			||||||
	if orphan {
 | 
						if orphan {
 | 
				
			||||||
		wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) { return gc.GraphHasUID(podUIDs), nil })
 | 
							wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) { return gc.GraphHasUID(podUIDs), nil })
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// delete the rc
 | 
						// delete the rc
 | 
				
			||||||
	if err := rcClient.Delete(rc.ObjectMeta.Name, options); err != nil {
 | 
						if err := rcClient.Delete(rc.ObjectMeta.Name, options); err != nil {
 | 
				
			||||||
@@ -516,7 +516,7 @@ func TestStressingCascadingDeletion(t *testing.T) {
 | 
				
			|||||||
	wg.Wait()
 | 
						wg.Wait()
 | 
				
			||||||
	t.Logf("all pods are created, all replications controllers are created then deleted")
 | 
						t.Logf("all pods are created, all replications controllers are created then deleted")
 | 
				
			||||||
	// wait for the RCs and Pods to reach the expected numbers.
 | 
						// wait for the RCs and Pods to reach the expected numbers.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 300*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 300*time.Second, func() (bool, error) {
 | 
				
			||||||
		podsInEachCollection := 3
 | 
							podsInEachCollection := 3
 | 
				
			||||||
		// see the comments on the calls to setupRCsPods for details
 | 
							// see the comments on the calls to setupRCsPods for details
 | 
				
			||||||
		remainingGroups := 3
 | 
							remainingGroups := 3
 | 
				
			||||||
@@ -583,14 +583,14 @@ func TestOrphaning(t *testing.T) {
 | 
				
			|||||||
	// we need wait for the gc to observe the creation of the pods, otherwise if
 | 
						// we need wait for the gc to observe the creation of the pods, otherwise if
 | 
				
			||||||
	// the deletion of RC is observed before the creation of the pods, the pods
 | 
						// the deletion of RC is observed before the creation of the pods, the pods
 | 
				
			||||||
	// will not be orphaned.
 | 
						// will not be orphaned.
 | 
				
			||||||
	wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) { return gc.GraphHasUID(podUIDs), nil })
 | 
						wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) { return gc.GraphHasUID(podUIDs), nil })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = rcClient.Delete(toBeDeletedRCName, getOrphanOptions())
 | 
						err = rcClient.Delete(toBeDeletedRCName, getOrphanOptions())
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("Failed to gracefully delete the rc: %v", err)
 | 
							t.Fatalf("Failed to gracefully delete the rc: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// verify the toBeDeleteRC is deleted
 | 
						// verify the toBeDeleteRC is deleted
 | 
				
			||||||
	if err := wait.PollImmediate(5*time.Second, 30*time.Second, func() (bool, error) {
 | 
						if err := wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) {
 | 
				
			||||||
		rcs, err := rcClient.List(metav1.ListOptions{})
 | 
							rcs, err := rcClient.List(metav1.ListOptions{})
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return false, err
 | 
								return false, err
 | 
				
			||||||
@@ -654,7 +654,7 @@ func TestSolidOwnerDoesNotBlockWaitingOwner(t *testing.T) {
 | 
				
			|||||||
		t.Fatalf("Failed to delete the rc: %v", err)
 | 
							t.Fatalf("Failed to delete the rc: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// verify the toBeDeleteRC is deleted
 | 
						// verify the toBeDeleteRC is deleted
 | 
				
			||||||
	if err := wait.PollImmediate(5*time.Second, 30*time.Second, func() (bool, error) {
 | 
						if err := wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := rcClient.Get(toBeDeletedRC.Name, metav1.GetOptions{})
 | 
							_, err := rcClient.Get(toBeDeletedRC.Name, metav1.GetOptions{})
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			if errors.IsNotFound(err) {
 | 
								if errors.IsNotFound(err) {
 | 
				
			||||||
@@ -722,7 +722,7 @@ func TestNonBlockingOwnerRefDoesNotBlock(t *testing.T) {
 | 
				
			|||||||
		t.Fatalf("Failed to delete the rc: %v", err)
 | 
							t.Fatalf("Failed to delete the rc: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// verify the toBeDeleteRC is deleted
 | 
						// verify the toBeDeleteRC is deleted
 | 
				
			||||||
	if err := wait.PollImmediate(5*time.Second, 30*time.Second, func() (bool, error) {
 | 
						if err := wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := rcClient.Get(toBeDeletedRC.Name, metav1.GetOptions{})
 | 
							_, err := rcClient.Get(toBeDeletedRC.Name, metav1.GetOptions{})
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			if errors.IsNotFound(err) {
 | 
								if errors.IsNotFound(err) {
 | 
				
			||||||
@@ -844,7 +844,7 @@ func TestCustomResourceCascadingDeletion(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ensure the owner is deleted.
 | 
						// Ensure the owner is deleted.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := resourceClient.Get(owner.GetName(), metav1.GetOptions{})
 | 
							_, err := resourceClient.Get(owner.GetName(), metav1.GetOptions{})
 | 
				
			||||||
		return errors.IsNotFound(err), nil
 | 
							return errors.IsNotFound(err), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
@@ -922,7 +922,7 @@ func TestMixedRelationships(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ensure the owner is deleted.
 | 
						// Ensure the owner is deleted.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := resourceClient.Get(customOwner.GetName(), metav1.GetOptions{})
 | 
							_, err := resourceClient.Get(customOwner.GetName(), metav1.GetOptions{})
 | 
				
			||||||
		return errors.IsNotFound(err), nil
 | 
							return errors.IsNotFound(err), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
@@ -946,7 +946,7 @@ func TestMixedRelationships(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ensure the owner is deleted.
 | 
						// Ensure the owner is deleted.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := configMapClient.Get(coreOwner.GetName(), metav1.GetOptions{})
 | 
							_, err := configMapClient.Get(coreOwner.GetName(), metav1.GetOptions{})
 | 
				
			||||||
		return errors.IsNotFound(err), nil
 | 
							return errors.IsNotFound(err), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
@@ -1002,7 +1002,7 @@ func TestCRDDeletionCascading(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ensure the owner is deleted.
 | 
						// Ensure the owner is deleted.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := resourceClient.Get(owner.GetName(), metav1.GetOptions{})
 | 
							_, err := resourceClient.Get(owner.GetName(), metav1.GetOptions{})
 | 
				
			||||||
		return errors.IsNotFound(err), nil
 | 
							return errors.IsNotFound(err), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
@@ -1010,7 +1010,7 @@ func TestCRDDeletionCascading(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ensure the dependent is deleted.
 | 
						// Ensure the dependent is deleted.
 | 
				
			||||||
	if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) {
 | 
						if err := wait.Poll(1*time.Second, 60*time.Second, func() (bool, error) {
 | 
				
			||||||
		_, err := configMapClient.Get(dependent.GetName(), metav1.GetOptions{})
 | 
							_, err := configMapClient.Get(dependent.GetName(), metav1.GetOptions{})
 | 
				
			||||||
		return errors.IsNotFound(err), nil
 | 
							return errors.IsNotFound(err), nil
 | 
				
			||||||
	}); err != nil {
 | 
						}); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user