use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineVersionManagerTest method getPipelineConfig.
@Test
@Ignore
public void getPipelineConfig() throws GitClientException, IOException {
Pipeline mockPipeline = new Pipeline();
mockPipeline.setRepository(TEST_HTTP_REPOSITORY);
mockPipeline.setId(1L);
Mockito.when(pipelineManagerMock.load(mockPipeline.getId())).thenReturn(mockPipeline);
Mockito.when(gitManager.getConfigFileContent(mockPipeline, TEST_REVISION_1)).thenReturn(getFileContent(TEST_CONFIG));
PipelineConfiguration configuration = pipelineVersionManager.loadParametersFromScript(1L, TEST_REVISION_1);
Assert.assertNotNull(configuration);
Assert.assertEquals(EXPECTED_DEFAULT_PARAMS, configuration.getParameters().size());
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineVersionManagerTest method testDockerImageSetFromConfig.
@Test
public void testDockerImageSetFromConfig() throws GitClientException, IOException {
Tool mockTool = getMockTool(TEST_REPOSITORY, IMAGE_FROM_CONFIG);
Mockito.when(gitManager.getConfigFileContent(Mockito.any(Pipeline.class), Mockito.anyString())).thenReturn(getFileContent(WITH_IMAGE_CONFIG));
Mockito.when(toolManager.loadByNameOrId(IMAGE_FROM_CONFIG)).thenReturn(mockTool);
PipelineConfiguration configuration = pipelineVersionManager.loadParametersFromScript(1L, "");
Assert.assertEquals(TEST_REPOSITORY + "/" + IMAGE_FROM_CONFIG, configuration.getDockerImage());
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class PipelineVersionManagerTest method testImageWithValidRepository.
@Test
public void testImageWithValidRepository() throws GitClientException, IOException {
Mockito.when(preferenceManager.getPreference(SystemPreferences.LAUNCH_DOCKER_IMAGE)).thenReturn(TEST_REPOSITORY + "/" + IMAGE_FROM_PROPERTIES);
Tool mockTool = getMockTool(TEST_REPOSITORY, IMAGE_FROM_PROPERTIES);
Mockito.when(gitManager.getConfigFileContent(Mockito.any(Pipeline.class), Mockito.anyString())).thenReturn(getFileContent(WITHOUT_IMAGE_CONFIG));
Mockito.when(toolManager.loadByNameOrId(TEST_REPOSITORY + "/" + IMAGE_FROM_PROPERTIES)).thenReturn(mockTool);
PipelineConfiguration configuration = pipelineVersionManager.loadParametersFromScript(1L, "");
Assert.assertEquals(TEST_REPOSITORY + "/" + IMAGE_FROM_PROPERTIES, configuration.getDockerImage());
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class RunConfigurationProviderTest method validateShouldUseToolResourceWhileCheckingToolAllowedIfDockerImageIsSpecified.
@Test
public void validateShouldUseToolResourceWhileCheckingToolAllowedIfDockerImageIsSpecified() {
final PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
pipelineConfiguration.setInstanceType(ALLOWED_INSTANCE_TYPE);
pipelineConfiguration.setDockerImage(TOOL_IMAGE);
final RunConfigurationEntry runConfigurationEntry = new RunConfigurationEntry();
runConfigurationEntry.setConfiguration(pipelineConfiguration);
runConfigurationProvider.validateEntry(runConfigurationEntry);
verify(instanceOfferManager).isToolInstanceAllowed(any(), eq(TOOL_RESOURCE));
}
use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.
the class RunConfigurationProviderTest method validateShouldFailIfConfigurationInstanceTypeIsNotAllowed.
@Test
public void validateShouldFailIfConfigurationInstanceTypeIsNotAllowed() {
final PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
pipelineConfiguration.setInstanceType(NOT_ALLOWED_INSTANCE_TYPE);
final RunConfigurationEntry runConfigurationEntry = new RunConfigurationEntry();
runConfigurationEntry.setConfiguration(pipelineConfiguration);
assertThrows(IllegalArgumentException.class, () -> runConfigurationProvider.validateEntry(runConfigurationEntry));
verify(instanceOfferManager).isToolInstanceAllowed(eq(NOT_ALLOWED_INSTANCE_TYPE), any());
}
Aggregations