Java Code Examples for com.netflix.fenzo.ConstraintEvaluator#Result
The following examples show how to use
com.netflix.fenzo.ConstraintEvaluator#Result .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KubeConstraintTest.java From titus-control-plane with Apache License 2.0 | 6 votes |
@Test public void taintNotToleratedInConfiguration() { AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID); when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance)); V1Taint taint = createTaint("not_tolerated_taint_key", "NoSchedule", "not_tolerated_taint_value"); V1Node node = createNode(INSTANCE_ID, true, Collections.singletonList(taint)); when(indexer.getByKey(INSTANCE_ID)).thenReturn(node); ConstraintEvaluator.Result result = kubeConstraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isFalse(); assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.TAINT_NOT_TOLERATED_IN_CONFIGURATION_REASON); }
Example 2
Source File: AgentContainerLimitSystemConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void testAtLeastOneContainerCanBeScheduled() { when(schedulerConfiguration.getMaxLaunchingTasksPerMachine()).thenReturn(0); ConstraintEvaluator.Result result = constraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isTrue(); }
Example 3
Source File: AgentContainerLimitSystemConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void testContainerLimit() { when(schedulerConfiguration.getMaxLaunchingTasksPerMachine()).thenReturn(2); ConstraintEvaluator.Result result = constraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), createMockAssignmentResultList(2)), taskTrackerState); assertThat(result.isSuccessful()).isFalse(); }
Example 4
Source File: KubeConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void instanceNotFound() { when(agentManagementService.findAgentInstance(any())).thenReturn(Optional.empty()); ConstraintEvaluator.Result result = kubeConstraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isFalse(); assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.INSTANCE_NOT_FOUND_REASON); }
Example 5
Source File: KubeConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void nodeNotFound() { AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID); when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance)); when(indexer.getByKey(INSTANCE_ID)).thenReturn(null); ConstraintEvaluator.Result result = kubeConstraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isFalse(); assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.NODE_NOT_FOUND_REASON); }
Example 6
Source File: KubeConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void nodeNotReady() { AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID); when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance)); V1Node node = createNode(INSTANCE_ID, false, Collections.emptyList()); when(indexer.getByKey(INSTANCE_ID)).thenReturn(node); ConstraintEvaluator.Result result = kubeConstraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isFalse(); assertThat(result.getFailureReason()).isEqualToIgnoringCase(KubeConstraint.NODE_NOT_READY_REASON); }
Example 7
Source File: KubeConstraintTest.java From titus-control-plane with Apache License 2.0 | 5 votes |
@Test public void successfullyScheduled() { AgentInstance agentInstance = createAgentInstance(INSTANCE_ID, INSTANCE_GROUP_ID); when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(agentInstance)); V1Taint taint = createTaint("tolerated_taint_key", "NoSchedule", "tolerated_taint_value"); V1Node node = createNode(INSTANCE_ID, true, Collections.singletonList(taint)); when(indexer.getByKey(INSTANCE_ID)).thenReturn(node); ConstraintEvaluator.Result result = kubeConstraint.evaluate( createTaskRequest(TASK_ID), createVirtualMachineCurrentStateMock(INSTANCE_ID, Collections.emptyList(), Collections.emptyList()), taskTrackerState); assertThat(result.isSuccessful()).isTrue(); }