use of com.thoughtworks.go.config.elastic.ElasticConfig in project gocd by gocd.
the class UpdateClusterProfileCommandTest method shouldValidateElasticAgentProfilesAsPartOfUpdateClusterProfile.
@Test
void shouldValidateElasticAgentProfilesAsPartOfUpdateClusterProfile() {
ElasticConfig elasticConfig = new ElasticConfig();
elasticConfig.getClusterProfiles().add(new ClusterProfile("cluster1", "ecs"));
elasticConfig.getProfiles().add(new ElasticProfile("profile1", "cluster1"));
config.setElasticConfig(elasticConfig);
RecordNotFoundException exception = assertThrows(RecordNotFoundException.class, () -> command.isValid(config));
assertThat(exception.getMessage()).isEqualTo("Cluster profile with id 'cluster-id' was not found!");
}
use of com.thoughtworks.go.config.elastic.ElasticConfig in project gocd by gocd.
the class ClusterProfilesServiceTest method shouldFetchClustersDefinedAsPartOfElasticTag.
@Test
void shouldFetchClustersDefinedAsPartOfElasticTag() {
ElasticConfig elasticConfig = new ElasticConfig();
elasticConfig.setClusterProfiles(new ClusterProfiles(clusterProfile));
when(goConfigService.getElasticConfig()).thenReturn(elasticConfig);
PluginProfiles<ClusterProfile> actualClusterProfiles = clusterProfilesService.getPluginProfiles();
assertThat(actualClusterProfiles).isEqualTo(elasticConfig.getClusterProfiles());
}
use of com.thoughtworks.go.config.elastic.ElasticConfig in project gocd by gocd.
the class ElasticProfileServiceTest method shouldReturnAnEmptyMapIfNoElasticProfiles.
@Test
void shouldReturnAnEmptyMapIfNoElasticProfiles() {
ElasticConfig elasticConfig = new ElasticConfig();
when(goConfigService.getElasticConfig()).thenReturn(elasticConfig);
assertThat(elasticProfileService.listAll()).isEmpty();
}
use of com.thoughtworks.go.config.elastic.ElasticConfig in project gocd by gocd.
the class ElasticProfileServiceTest method shouldReturnElasticProfileWithGivenIdWhenPresent.
@Test
void shouldReturnElasticProfileWithGivenIdWhenPresent() {
ElasticConfig elasticConfig = new ElasticConfig();
ElasticProfile elasticProfile = new ElasticProfile("ecs", "prod-cluster");
elasticConfig.getProfiles().add(elasticProfile);
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setElasticConfig(elasticConfig);
when(goConfigService.getConfigForEditing()).thenReturn(cruiseConfig);
assertThat(elasticProfileService.findProfile("ecs")).isEqualTo(elasticProfile);
}
use of com.thoughtworks.go.config.elastic.ElasticConfig in project gocd by gocd.
the class ClusterProfilesChangedPluginNotifierTest method shouldNotifyPluginRegistryWhenANewClusterProfileIsCreated.
@Test
void shouldNotifyPluginRegistryWhenANewClusterProfileIsCreated() {
reset(goConfigService);
ElasticConfig elasticConfig = new ElasticConfig();
elasticConfig.getClusterProfiles().add(newClusterProfile);
when(goConfigService.getElasticConfig()).thenReturn(elasticConfig);
notifier.onEntityConfigChange(newClusterProfile);
verify(secretParamResolver).resolve(newClusterProfile);
verify(registry, times(1)).notifyPluginAboutClusterProfileChanged(pluginId, ClusterProfilesChangedStatus.CREATED, null, newClusterProfile.getConfigurationAsMap(true));
verifyNoMoreInteractions(registry);
verify(goConfigService, times(2)).getElasticConfig();
}
Aggregations