use of com.thoughtworks.go.config.elastic.ElasticProfiles in project gocd by gocd.
the class PipelineConfigSaveValidationContextTest method isValidProfileIdShouldBeValidInPresenceOfElasticProfile.
@Test
void isValidProfileIdShouldBeValidInPresenceOfElasticProfile() {
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
ElasticConfig elasticConfig = new ElasticConfig();
elasticConfig.setProfiles(new ElasticProfiles(new ElasticProfile("docker.unit-test", "prod-cluster")));
cruiseConfig.setElasticConfig(elasticConfig);
ValidationContext context = PipelineConfigSaveValidationContext.forChain(true, "group", cruiseConfig, new PipelineConfig());
assertTrue(context.isValidProfileId("docker.unit-test"));
}
use of com.thoughtworks.go.config.elastic.ElasticProfiles in project gocd by gocd.
the class PipelineConfigSaveValidationContextTest method isValidProfileIdShouldBeInValidInAbsenceOfElasticProfileForTheGivenId.
@Test
void isValidProfileIdShouldBeInValidInAbsenceOfElasticProfileForTheGivenId() {
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
ElasticConfig elasticConfig = new ElasticConfig();
elasticConfig.setProfiles(new ElasticProfiles(new ElasticProfile("docker.unit-test", "prod-cluster")));
cruiseConfig.setElasticConfig(elasticConfig);
ValidationContext context = PipelineConfigSaveValidationContext.forChain(true, "group", cruiseConfig, new PipelineConfig());
assertThat(context.isValidProfileId("invalid.profile-id")).isFalse();
}
use of com.thoughtworks.go.config.elastic.ElasticProfiles in project gocd by gocd.
the class ElasticAgentProfileUpdateCommand method update.
@Override
public void update(CruiseConfig preprocessedConfig) {
ElasticProfile existingProfile = findExistingProfile(preprocessedConfig);
ElasticProfiles profiles = getPluginProfiles(preprocessedConfig);
profiles.set(profiles.indexOf(existingProfile), elasticProfile);
}
Aggregations