@Test public void testComputeHealthyPoolSizeFromAbsoluteLimit() { testComputeHealthyPoolSizeFromAbsoluteLimit(newBatchJobWithAbsoluteLimit(0, 10), 0); testComputeHealthyPoolSizeFromAbsoluteLimit(newBatchJobWithAbsoluteLimit(1, 10), 0); testComputeHealthyPoolSizeFromAbsoluteLimit(newBatchJobWithAbsoluteLimit(1, 2), 0); testComputeHealthyPoolSizeFromAbsoluteLimit(newBatchJobWithAbsoluteLimit(10, 5), 5); }
@VisibleForTesting static int computeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, UnhealthyTasksLimitDisruptionBudgetPolicy policy) { return Math.max(0, JobFunctions.getJobDesiredSize(job) - Math.max(1, policy.getLimitOfUnhealthyContainers())); }
UnhealthyTasksLimitTracker implements QuotaTracker { @VisibleForTesting static int computeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, UnhealthyTasksLimitDisruptionBudgetPolicy policy) { return Math.max(0, JobFunctions.getJobDesiredSize(job) - Math.max(1, policy.getLimitOfUnhealthyContainers())); } }
UnhealthyTasksLimitTracker implements QuotaTracker { @VisibleForTesting static int computeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, UnhealthyTasksLimitDisruptionBudgetPolicy policy) { return Math.max(0, JobFunctions.getJobDesiredSize(job) - Math.max(1, policy.getLimitOfUnhealthyContainers())); } private  UnhealthyTasksLimitTracker(Job<?> job,
                                       int minimumHealthyCount,
                                       V3JobOperations jobOperations,
                                       ContainerHealthService containerHealthService); }
UnhealthyTasksLimitTracker implements QuotaTracker { @VisibleForTesting static int computeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, UnhealthyTasksLimitDisruptionBudgetPolicy policy) { return Math.max(0, JobFunctions.getJobDesiredSize(job) - Math.max(1, policy.getLimitOfUnhealthyContainers())); } private  UnhealthyTasksLimitTracker(Job<?> job,
                                       int minimumHealthyCount,
                                       V3JobOperations jobOperations,
                                       ContainerHealthService containerHealthService); @Override EvictionQuota getQuota(Reference reference); static UnhealthyTasksLimitTracker percentageLimit(Job<?> job,
                                                             AvailabilityPercentageLimitDisruptionBudgetPolicy policy,
                                                             V3JobOperations jobOperations,
                                                             ContainerHealthService containerHealthService); static UnhealthyTasksLimitTracker absoluteLimit(Job<?> job,
                                                           UnhealthyTasksLimitDisruptionBudgetPolicy policy,
                                                           V3JobOperations jobOperations,
                                                           ContainerHealthService containerHealthService); }
UnhealthyTasksLimitTracker implements QuotaTracker { @VisibleForTesting static int computeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, UnhealthyTasksLimitDisruptionBudgetPolicy policy) { return Math.max(0, JobFunctions.getJobDesiredSize(job) - Math.max(1, policy.getLimitOfUnhealthyContainers())); } private  UnhealthyTasksLimitTracker(Job<?> job,
                                       int minimumHealthyCount,
                                       V3JobOperations jobOperations,
                                       ContainerHealthService containerHealthService); @Override EvictionQuota getQuota(Reference reference); static UnhealthyTasksLimitTracker percentageLimit(Job<?> job,
                                                             AvailabilityPercentageLimitDisruptionBudgetPolicy policy,
                                                             V3JobOperations jobOperations,
                                                             ContainerHealthService containerHealthService); static UnhealthyTasksLimitTracker absoluteLimit(Job<?> job,
                                                           UnhealthyTasksLimitDisruptionBudgetPolicy policy,
                                                           V3JobOperations jobOperations,
                                                           ContainerHealthService containerHealthService);  }