Search in sources :

Example 1 with PluginRequest

use of com.thoughtworks.gocd.elasticagent.ecs.PluginRequest in project gocd-ecs-elastic-agent by gocd.

the class CreateAgentRequestExecutorTest method shouldAskECSTaskToCreateAnAgent.

@Test
void shouldAskECSTaskToCreateAnAgent() throws Exception {
    ClusterProfileProperties settings = mock(ClusterProfileProperties.class);
    CreateAgentRequest request = mock(CreateAgentRequest.class);
    when(request.clusterProfileProperties()).thenReturn(settings);
    when(request.getJobIdentifier()).thenReturn(new JobIdentifier("test-pipeline", 1L, "Test Pipeline", "test-stage", "1", "test-job", 100L));
    when(request.elasticProfile()).thenReturn(new ElasticAgentProfileProperties());
    ECSTasks agentInstances = mock(ECSTasks.class);
    PluginRequest pluginRequest = mock(PluginRequest.class);
    final EventStream eventStream = mock(EventStream.class);
    new CreateAgentRequestExecutor(request, agentInstances, pluginRequest, eventStream).execute();
    verify(agentInstances).create(eq(request), eq(settings), any(ConsoleLogAppender.class));
}
Also used : ClusterProfileProperties(com.thoughtworks.gocd.elasticagent.ecs.domain.ClusterProfileProperties) CreateAgentRequest(com.thoughtworks.gocd.elasticagent.ecs.requests.CreateAgentRequest) EventStream(com.thoughtworks.gocd.elasticagent.ecs.events.EventStream) JobIdentifier(com.thoughtworks.gocd.elasticagent.ecs.domain.JobIdentifier) ECSTasks(com.thoughtworks.gocd.elasticagent.ecs.ECSTasks) PluginRequest(com.thoughtworks.gocd.elasticagent.ecs.PluginRequest) ConsoleLogAppender(com.thoughtworks.gocd.elasticagent.ecs.domain.ConsoleLogAppender) ElasticAgentProfileProperties(com.thoughtworks.gocd.elasticagent.ecs.domain.ElasticAgentProfileProperties) Test(org.junit.jupiter.api.Test)

Aggregations

ECSTasks (com.thoughtworks.gocd.elasticagent.ecs.ECSTasks)1 PluginRequest (com.thoughtworks.gocd.elasticagent.ecs.PluginRequest)1 ClusterProfileProperties (com.thoughtworks.gocd.elasticagent.ecs.domain.ClusterProfileProperties)1 ConsoleLogAppender (com.thoughtworks.gocd.elasticagent.ecs.domain.ConsoleLogAppender)1 ElasticAgentProfileProperties (com.thoughtworks.gocd.elasticagent.ecs.domain.ElasticAgentProfileProperties)1 JobIdentifier (com.thoughtworks.gocd.elasticagent.ecs.domain.JobIdentifier)1 EventStream (com.thoughtworks.gocd.elasticagent.ecs.events.EventStream)1 CreateAgentRequest (com.thoughtworks.gocd.elasticagent.ecs.requests.CreateAgentRequest)1 Test (org.junit.jupiter.api.Test)1