JobQuotaController implements QuotaController<Job<?>> { @Override public EvictionQuota getQuota(Reference reference) { if (isLegacy()) { return EvictionQuota.newBuilder().withReference(reference).withQuota(0).withMessage("Legacy job").build(); } return getMinSubQuota(reference); } JobQuotaController(Job<?> job,
                              V3JobOperations jobOperations,
                              EffectiveJobDisruptionBudgetResolver effectiveDisruptionBudgetResolver,
                              ContainerHealthService containerHealthService,
                              TitusRuntime titusRuntime); private  JobQuotaController(Job<?> newJob,
                               V3JobOperations jobOperations,
                               EffectiveJobDisruptionBudgetResolver effectiveDisruptionBudgetResolver,
                               ContainerHealthService containerHealthService,
                               JobQuotaController previousJobQuotaController,
                               TitusRuntime titusRuntime); Job<?> getJob(); @Override EvictionQuota getQuota(Reference reference); @Override ConsumptionResult consume(String taskId); @Override void giveBackConsumedQuota(String taskId); @Override JobQuotaController update(Job<?> updatedJob);  }
@Test public void testGetQuota() { Job<BatchJobExt> job = newBatchJob(10, budget(percentageOfHealthyPolicy(80.0), hourlyRatePercentage(50), singletonList(officeHourTimeWindow()))); com.netflix.titus.api.model.reference.Reference jobReference = com.netflix.titus.api.model.reference.Reference.job(job.getId()); scheduleJob(job, 10); JobQuotaController jobController = new JobQuotaController(job, jobOperations, SelfJobDisruptionBudgetResolver.getInstance(), containerHealthService, titusRuntime); assertThat(jobController.getQuota(jobReference).getQuota()).isEqualTo(2); clock.jumpForwardTo(DayOfWeek.SATURDAY); assertThat(jobController.getQuota(jobReference).getQuota()).isEqualTo(0); }