FarzonePodResourcePoolResolver implements PodResourcePoolResolver { @Override public List<ResourcePoolAssignment> resolve(Job<?> job) { return KubeUtil.findFarzoneId(configuration, job).map(farzone -> { String resourcePoolName = PodResourcePoolResolvers.RESOURCE_POOL_ELASTIC_FARZONE_PREFIX + farzone; return Collections.singletonList(ResourcePoolAssignment.newBuilder() .withResourcePoolName(resourcePoolName) .withRule(String.format("Farzone %s assigned to resource pool %s", farzone, resourcePoolName)) .build() ); } ).orElse(Collections.emptyList()); } FarzonePodResourcePoolResolver(DirectKubeConfiguration configuration); @Override List<ResourcePoolAssignment> resolve(Job<?> job);  }
@Test public void testFarzoneJobAssignment() { List<ResourcePoolAssignment> result = resolver.resolve(newJob(FARZONE_ID)); assertThat(result).hasSize(1); assertThat(result.get(0).getResourcePoolName()).isEqualTo(PodResourcePoolResolvers.RESOURCE_POOL_ELASTIC_FARZONE_PREFIX + FARZONE_ID); }
@Test public void testNoneFarzoneJobAssignment() { List<ResourcePoolAssignment> result = resolver.resolve(newJob("regularZone")); assertThat(result).hasSize(0); }