Search in sources :

Example 41 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class RunConfigurationProviderTest method validateShouldNotValidateInstanceTypeIfConfigurationInstanceTypeIsNotSpecified.

@Test
public void validateShouldNotValidateInstanceTypeIfConfigurationInstanceTypeIsNotSpecified() {
    final PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
    pipelineConfiguration.setInstanceType(null);
    final RunConfigurationEntry runConfigurationEntry = new RunConfigurationEntry();
    runConfigurationEntry.setConfiguration(pipelineConfiguration);
    runConfigurationProvider.validateEntry(runConfigurationEntry);
    verify(instanceOfferManager, times(0)).isToolInstanceAllowed(any(), any());
}
Also used : PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Test(org.junit.Test)

Example 42 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class RunConfigurationProviderTest method validateShouldValidateConfigurationInstanceType.

@Test
public void validateShouldValidateConfigurationInstanceType() {
    final PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
    pipelineConfiguration.setInstanceType(ALLOWED_INSTANCE_TYPE);
    final RunConfigurationEntry runConfigurationEntry = new RunConfigurationEntry();
    runConfigurationEntry.setConfiguration(pipelineConfiguration);
    runConfigurationProvider.validateEntry(runConfigurationEntry);
    verify(instanceOfferManager).isToolInstanceAllowed(eq(ALLOWED_INSTANCE_TYPE), any());
}
Also used : PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Test(org.junit.Test)

Example 43 with PipelineConfiguration

use of com.epam.pipeline.entity.configuration.PipelineConfiguration in project cloud-pipeline by epam.

the class ConfigurationMapperTest method shouldMapRunConfiguration.

@Test
void shouldMapRunConfiguration() throws IOException {
    ConfigurationEntryMapper mapper = new ConfigurationEntryMapper();
    Pipeline pipeline = buildPipeline();
    RunConfiguration runConfiguration = buildRunConfiguration();
    PipelineConfiguration pipelineConfiguration = new PipelineConfiguration();
    pipelineConfiguration.setDockerImage(TEST_PATH);
    RunConfigurationEntry entry = new RunConfigurationEntry();
    entry.setPipelineVersion(TEST_VERSION);
    entry.setName(TEST_NAME);
    entry.setConfiguration(pipelineConfiguration);
    ConfigurationEntryDoc configuration = buildDoc(pipeline, runConfiguration, entry);
    XContentBuilder contentBuilder = mapper.map(buildContainer(configuration));
    verifyRunConfiguration(runConfiguration, TEST_NAME + " ", contentBuilder);
    verifyRunConfigurationEntry(entry, pipeline, contentBuilder);
    verifyPipelineUser(USER, contentBuilder);
    verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder);
    verifyMetadata(EXPECTED_METADATA, contentBuilder);
}
Also used : MapperVerificationUtils.verifyRunConfiguration(com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfiguration) RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) PipelineConfiguration(com.epam.pipeline.entity.configuration.PipelineConfiguration) AbstractRunConfigurationEntry(com.epam.pipeline.entity.configuration.AbstractRunConfigurationEntry) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) MapperVerificationUtils.verifyRunConfigurationEntry(com.epam.pipeline.elasticsearchagent.MapperVerificationUtils.verifyRunConfigurationEntry) FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) ConfigurationEntryDoc(com.epam.pipeline.elasticsearchagent.model.ConfigurationEntryDoc) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) Test(org.junit.jupiter.api.Test)

Aggregations

PipelineConfiguration (com.epam.pipeline.entity.configuration.PipelineConfiguration)43 Test (org.junit.Test)16 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)12 Tool (com.epam.pipeline.entity.pipeline.Tool)12 RunConfigurationEntry (com.epam.pipeline.entity.configuration.RunConfigurationEntry)10 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)9 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)9 PipelineStart (com.epam.pipeline.entity.pipeline.run.PipelineStart)8 List (java.util.List)7 ConfigurationEntry (com.epam.pipeline.entity.configuration.ConfigurationEntry)6 Before (org.junit.Before)6 PipeConfValueVO (com.epam.pipeline.entity.configuration.PipeConfValueVO)5 HashMap (java.util.HashMap)5 Collectors (java.util.stream.Collectors)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 Transactional (org.springframework.transaction.annotation.Transactional)5 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)4 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)4 RunInstance (com.epam.pipeline.entity.pipeline.RunInstance)4 ArrayList (java.util.ArrayList)4