UnhealthyTasksLimitTracker implements QuotaTracker { @VisibleForTesting static int computeHealthyPoolSizeFromPercentage(Job<?> job, AvailabilityPercentageLimitDisruptionBudgetPolicy policy) { int jobDesiredSize = JobFunctions.getJobDesiredSize(job); if (jobDesiredSize == 0) { return 0; } double percentageOfHealthy = policy.getPercentageOfHealthyContainers(); int minimumHealthyCount = (int) Math.ceil((percentageOfHealthy * jobDesiredSize) / 100); return Math.min(minimumHealthyCount, jobDesiredSize - 1); } 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);  }
@Test public void testComputeHealthyPoolSizeFromPercentage() { testComputeHealthyPoolSizeFromPercentage(newBatchJobWithPercentageLimit(0, 80), 0); testComputeHealthyPoolSizeFromPercentage(newBatchJobWithPercentageLimit(1, 80), 0); testComputeHealthyPoolSizeFromPercentage(newBatchJobWithPercentageLimit(2, 80), 1); testComputeHealthyPoolSizeFromPercentage(newBatchJobWithPercentageLimit(10, 80), 8); }