use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineConfigurationForRunnerTest method shouldGetSpecifiedConfigurationForToolVersionRun.
@Test
public void shouldGetSpecifiedConfigurationForToolVersionRun() {
Tool tool = new Tool();
tool.setImage(TEST_IMAGE);
tool.setRam(TEST_RAM);
tool.setCpu(TEST_CPU);
ConfigurationEntry otherConfigurationEntry = new ConfigurationEntry();
otherConfigurationEntry.setName(TEST_CONFIGURATION_NAME);
PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
pipelineConfiguration.setInstanceDisk(TEST_HDD_SIZE);
otherConfigurationEntry.setConfiguration(pipelineConfiguration);
when(toolVersionManagerMock.loadToolVersionSettings(anyLong(), anyString())).thenReturn(Collections.singletonList(ToolVersion.builder().settings(Arrays.asList(configurationEntry, otherConfigurationEntry)).build()));
PipelineStart vo = getPipelineStartVO();
vo.setHddSize(null);
vo.setConfigurationName(TEST_CONFIGURATION_NAME);
PipelineConfiguration config = pipelineConfigurationManager.getPipelineConfiguration(vo, tool);
commonPipelineConfigurationAssertions(config);
assertThat(config).hasFieldOrPropertyWithValue(INSTANCE_DISK_FIELD, // from configuration
TEST_HDD_SIZE);
assertThat(config.getParameters()).isNotEmpty().hasSize(1).containsKeys(TEST_PARAM_1);
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineConfigurationForRunnerTest method shouldGetDefaultConfigurationForToolVersionRun.
@Test
public void shouldGetDefaultConfigurationForToolVersionRun() {
Tool tool = new Tool();
tool.setImage(TEST_IMAGE);
tool.setRam(TEST_RAM);
tool.setCpu(TEST_CPU);
tool.setDisk(Integer.parseInt(TEST_HDD_SIZE));
PipelineStart vo = getPipelineStartVO();
vo.setHddSize(null);
PipelineConfiguration config = pipelineConfigurationManager.getPipelineConfiguration(vo, tool);
commonPipelineConfigurationAssertions(config);
assertThat(config).hasFieldOrPropertyWithValue(INSTANCE_DISK_FIELD, // from tool
TEST_HDD_SIZE);
assertThat(config.getParameters()).isNotEmpty().hasSize(2).containsKeys(TEST_PARAM_1, // from default configuration
TEST_PARAM_2);
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineConfigurationForRunnerTest method shouldGetConfigurationForPodRun.
@Test
public void shouldGetConfigurationForPodRun() {
PipelineStart vo = getPipelineStartVO();
PipelineConfiguration config = pipelineConfigurationManager.getPipelineConfiguration(vo);
commonPipelineConfigurationAssertions(config);
assertThat(config).hasFieldOrPropertyWithValue(INSTANCE_DISK_FIELD, TEST_HDD_SIZE);
assertThat(config.getParameters()).isNotEmpty().hasSize(1).containsKeys(TEST_PARAM_1);
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineRunManagerTest method testRunCmdFailed.
/**
* Tests that Aspect will deny PipelineRunManager::runCmd method execution
*/
@Test(expected = ToolExecutionDeniedException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testRunCmdFailed() {
PipelineStart startVO = new PipelineStart();
preferenceManager.update(Arrays.asList(new Preference(SystemPreferences.DOCKER_SECURITY_TOOL_POLICY_DENY_NOT_SCANNED.getKey(), Boolean.toString(true))));
startVO.setDockerImage(TEST_IMAGE);
pipelineRunManager.runCmd(startVO);
}
use of com.epam.pipeline.entity.pipeline.run.PipelineStart in project cloud-pipeline by epam.
the class PipelineRunManagerTest method testAdminRunForce.
/**
* Tests that Admin can run any tool
*/
@WithMockUser(roles = "ADMIN")
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testAdminRunForce() {
PipelineStart startVO = new PipelineStart();
startVO.setDockerImage(TEST_IMAGE);
startVO.setForce(true);
startVO.setInstanceType(INSTANCE_TYPE);
startVO.setHddSize(1);
pipelineRunManager.runCmd(startVO);
verify(notificationManager).notifyRunStatusChanged(any());
}
Aggregations