func getResourceList(cpu, memory string) api.ResourceList { … } func getResourceRequirements(requests, limits api.ResourceList) api.ResourceRequirements { … } func getVolumeResourceRequirements(requests, limits api.ResourceList) api.VolumeResourceRequirements { … } func validPod(name string, numContainers int, resources api.ResourceRequirements) *api.Pod { … } func validPodWithPriority(name string, numContainers int, resources api.ResourceRequirements, priorityClass string) *api.Pod { … } func validPersistentVolumeClaim(name string, resources api.VolumeResourceRequirements) *api.PersistentVolumeClaim { … } func createHandler(kubeClient kubernetes.Interface, informerFactory informers.SharedInformerFactory, stopCh chan struct{ … } func createHandlerWithConfig(kubeClient kubernetes.Interface, informerFactory informers.SharedInformerFactory, config *resourcequotaapi.Configuration, stopCh chan struct{ … } // TestAdmissionIgnoresDelete verifies that the admission controller ignores delete operations func TestAdmissionIgnoresDelete(t *testing.T) { … } // TestAdmissionIgnoresSubresources verifies that the admission controller ignores subresources // It verifies that creation of a pod that would have exceeded quota is properly failed // It verifies that create operations to a subresource that would have exceeded quota would succeed func TestAdmissionIgnoresSubresources(t *testing.T) { … } // TestAdmitBelowQuotaLimit verifies that a pod when created has its usage reflected on the quota func TestAdmitBelowQuotaLimit(t *testing.T) { … } // TestAdmitDryRun verifies that a pod when created with dry-run doesn not have its usage reflected on the quota // and that dry-run requests can still be rejected if they would exceed the quota func TestAdmitDryRun(t *testing.T) { … } // TestAdmitHandlesOldObjects verifies that admit handles updates correctly with old objects func TestAdmitHandlesOldObjects(t *testing.T) { … } func TestAdmitHandlesNegativePVCUpdates(t *testing.T) { … } func TestAdmitHandlesPVCUpdates(t *testing.T) { … } // TestAdmitHandlesCreatingUpdates verifies that admit handles updates which behave as creates func TestAdmitHandlesCreatingUpdates(t *testing.T) { … } // TestAdmitExceedQuotaLimit verifies that if a pod exceeded allowed usage that its rejected during admission. func TestAdmitExceedQuotaLimit(t *testing.T) { … } // TestAdmitEnforceQuotaConstraints verifies that if a quota tracks a particular resource that that resource is // specified on the pod. In this case, we create a quota that tracks cpu request, memory request, and memory limit. // We ensure that a pod that does not specify a memory limit that it fails in admission. func TestAdmitEnforceQuotaConstraints(t *testing.T) { … } // TestAdmitPodInNamespaceWithoutQuota ensures that if a namespace has no quota, that a pod can get in func TestAdmitPodInNamespaceWithoutQuota(t *testing.T) { … } // TestAdmitBelowTerminatingQuotaLimit ensures that terminating pods are charged to the right quota. // It creates a terminating and non-terminating quota, and creates a terminating pod. // It ensures that the terminating quota is incremented, and the non-terminating quota is not. func TestAdmitBelowTerminatingQuotaLimit(t *testing.T) { … } // TestAdmitBelowBestEffortQuotaLimit creates a best effort and non-best effort quota. // It verifies that best effort pods are properly scoped to the best effort quota document. func TestAdmitBelowBestEffortQuotaLimit(t *testing.T) { … } func removeListWatch(in []testcore.Action) []testcore.Action { … } // TestAdmitBestEffortQuotaLimitIgnoresBurstable validates that a besteffort quota does not match a resource // guaranteed pod. func TestAdmitBestEffortQuotaLimitIgnoresBurstable(t *testing.T) { … } // TestAdmissionSetsMissingNamespace verifies that if an object lacks a // namespace, it will be set. func TestAdmissionSetsMissingNamespace(t *testing.T) { … } // TestAdmitRejectsNegativeUsage verifies that usage for any measured resource cannot be negative. func TestAdmitRejectsNegativeUsage(t *testing.T) { … } // TestAdmitWhenUnrelatedResourceExceedsQuota verifies that if resource X exceeds quota, it does not prohibit resource Y from admission. func TestAdmitWhenUnrelatedResourceExceedsQuota(t *testing.T) { … } // TestAdmitLimitedResourceNoQuota verifies if a limited resource is configured with no quota, it cannot be consumed. func TestAdmitLimitedResourceNoQuota(t *testing.T) { … } // TestAdmitLimitedResourceNoQuotaIgnoresNonMatchingResources shows it ignores non matching resources in config. func TestAdmitLimitedResourceNoQuotaIgnoresNonMatchingResources(t *testing.T) { … } // TestAdmitLimitedResourceWithQuota verifies if a limited resource is configured with quota, it can be consumed. func TestAdmitLimitedResourceWithQuota(t *testing.T) { … } // TestAdmitLimitedResourceWithMultipleQuota verifies if a limited resource is configured with quota, it can be consumed if one matches. func TestAdmitLimitedResourceWithMultipleQuota(t *testing.T) { … } // TestAdmitLimitedResourceWithQuotaThatDoesNotCover verifies if a limited resource is configured the quota must cover the resource. func TestAdmitLimitedResourceWithQuotaThatDoesNotCover(t *testing.T) { … } // TestAdmitLimitedScopeWithQuota verifies if a limited scope is configured the quota must cover the resource. func TestAdmitLimitedScopeWithCoverQuota(t *testing.T) { … } // TestAdmitZeroDeltaUsageWithoutCoveringQuota verifies that resource quota is not required for zero delta requests. func TestAdmitZeroDeltaUsageWithoutCoveringQuota(t *testing.T) { … } // TestAdmitRejectIncreaseUsageWithoutCoveringQuota verifies that resource quota is required for delta requests that increase usage. func TestAdmitRejectIncreaseUsageWithoutCoveringQuota(t *testing.T) { … } // TestAdmitAllowDecreaseUsageWithoutCoveringQuota verifies that resource quota is not required for delta requests that decrease usage. func TestAdmitAllowDecreaseUsageWithoutCoveringQuota(t *testing.T) { … }