use of com.thoughtworks.go.plugin.domain.elastic.Capabilities in project gocd by gocd.
the class JobControllerIntegrationTest method jobDetailModel_shouldHaveTheElasticPluginIdAndElasticAgentIdWhenAgentIsAssigned.
@Test
public void jobDetailModel_shouldHaveTheElasticPluginIdAndElasticAgentIdWhenAgentIsAssigned() throws Exception {
Pipeline pipeline = fixture.createPipelineWithFirstStageAssigned();
Stage stage = pipeline.getFirstStage();
JobInstance job = stage.getFirstJob();
GoPluginDescriptor.About about = new GoPluginDescriptor.About("name", "0.1", "17.3.0", "desc", null, null);
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin_id", null, about, null, null, false);
ElasticAgentMetadataStore.instance().setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, new Capabilities(false, true)));
fixture.addJobAgentMetadata(new JobAgentMetadata(job.getId(), new ElasticProfile("profile_id", "plugin_id", Collections.EMPTY_LIST)));
final AgentConfig agentConfig = new AgentConfig(job.getAgentUuid());
agentConfig.setElasticAgentId("elastic_agent_id");
agentConfig.setElasticPluginId("plugin_id");
goConfigService.agents().add(agentConfig);
ModelAndView modelAndView = controller.jobDetail(pipeline.getName(), String.valueOf(pipeline.getCounter()), stage.getName(), String.valueOf(stage.getCounter()), job.getName());
assertThat(modelAndView.getModel().get("elasticAgentPluginId"), is("plugin_id"));
assertThat(modelAndView.getModel().get("elasticAgentId"), is("elastic_agent_id"));
}
Aggregations