Search in sources :

Example 6 with ResourceConfigs

use of com.thoughtworks.go.config.ResourceConfigs in project gocd by gocd.

the class AgentInstanceTest method shouldNotMatchJobPlanIfTheAgentIsElasticAndJobHasResourcesDefined.

@Test
public void shouldNotMatchJobPlanIfTheAgentIsElasticAndJobHasResourcesDefined() {
    AgentConfig agentConfig = new AgentConfig("uuid", "hostname", "11.1.1.1", new ResourceConfigs(new ResourceConfig("r1")));
    agentConfig.setElasticAgentId("elastic-agent-id-1");
    String elasticPluginId = "elastic-plugin-id-1";
    agentConfig.setElasticPluginId(elasticPluginId);
    AgentInstance agentInstance = new AgentInstance(agentConfig, REMOTE, mock(SystemEnvironment.class), null);
    DefaultJobPlan jobPlan1 = new DefaultJobPlan();
    jobPlan1.setResources(asList(new Resource("r1")));
    List<JobPlan> jobPlans = asList(jobPlan1, new DefaultJobPlan());
    assertThat(agentInstance.firstMatching(jobPlans), is(nullValue()));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) AgentConfig(com.thoughtworks.go.config.AgentConfig) ResourceConfig(com.thoughtworks.go.config.ResourceConfig) ResourceConfigs(com.thoughtworks.go.config.ResourceConfigs) Test(org.junit.Test)

Example 7 with ResourceConfigs

use of com.thoughtworks.go.config.ResourceConfigs in project gocd by gocd.

the class ResourcesTest method shouldConvertResourceConfigsToListOfResource.

@Test
public void shouldConvertResourceConfigsToListOfResource() {
    final Resources resources = new Resources(new ResourceConfigs("foo,bar"));
    assertThat(resources, hasSize(2));
    assertThat(resources, contains(new Resource("foo"), new Resource("bar")));
}
Also used : ResourceConfigs(com.thoughtworks.go.config.ResourceConfigs) Test(org.junit.Test)

Aggregations

ResourceConfigs (com.thoughtworks.go.config.ResourceConfigs)7 Test (org.junit.Test)7 ResourceConfig (com.thoughtworks.go.config.ResourceConfig)6 AgentConfig (com.thoughtworks.go.config.AgentConfig)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1