use of com.netflix.titus.runtime.endpoint.v3.rest.AutoScalingResource in project titus-control-plane by Netflix.
the class AutoScalingResourceTest method getPoliciesForJobFromTwoCells.
@Test
public void getPoliciesForJobFromTwoCells() {
ScalingPolicyID policy1 = ScalingPolicyID.newBuilder().setId(POLICY_1).build();
ScalingPolicyID policy2 = ScalingPolicyID.newBuilder().setId(POLICY_2).build();
ScalingPolicyResult policyOneResult = ScalingPolicyResult.newBuilder().setId(policy1).setJobId(JOB_1).build();
ScalingPolicyResult policyTwoResult = ScalingPolicyResult.newBuilder().setId(policy2).setJobId(JOB_2).build();
CellWithPolicies cellOneService = new CellWithPolicies(Collections.singletonList(policyOneResult));
CellWithPolicies cellTwoService = new CellWithPolicies(Collections.singletonList(policyTwoResult));
cellOne.getServiceRegistry().addService(cellOneService);
cellTwo.getServiceRegistry().addService(cellTwoService);
final AutoScalingResource autoScalingResource = new AutoScalingResource(service, callMetadataResolver);
final GetPolicyResult scalingPolicyForJob = autoScalingResource.getScalingPolicyForJob(JOB_2);
assertThat(scalingPolicyForJob).isNotNull();
assertThat(scalingPolicyForJob.getItemsCount()).isEqualTo(1);
assertThat(scalingPolicyForJob.getItems(0).getJobId()).isEqualTo(JOB_2);
}
Aggregations