Search in sources :

Example 6 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildWorkTest method shouldReportBuildIsFailedWhenAntBuildFailed.

@Test
public void shouldReportBuildIsFailedWhenAntBuildFailed() throws Exception {
    buildWork = (BuildWork) getWork(WILL_FAIL, PIPELINE_NAME);
    buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
    assertThat(buildRepository.results, containsResult(Failed));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 7 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildWorkTest method shouldReportDirectoryNotExists.

@Test
public void shouldReportDirectoryNotExists() throws Exception {
    buildWork = (BuildWork) getWork(NANT_WITH_WORKINGDIR, PIPELINE_NAME);
    buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
    assertThat(artifactManipulator.consoleOut(), containsString("not-exists\" is not a directory!"));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 8 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildWorkTest method shouldUpdateOnlyStatusWhenBuildIsIgnored.

@Test
public void shouldUpdateOnlyStatusWhenBuildIsIgnored() throws Exception {
    buildWork = (BuildWork) getWork(WILL_PASS, "pipeline1");
    buildRepository = new com.thoughtworks.go.remote.work.BuildRepositoryRemoteStub(true);
    buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
    assertThat(buildRepository.results.isEmpty(), is(true));
    assertThat(buildRepository.states, containsResult(JobState.Completed));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 9 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildWorkTest method rakeTest.

@Test
public void rakeTest() throws Exception {
    buildWork = (BuildWork) getWork(RAKE, PIPELINE_NAME);
    buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
    assertThat(artifactManipulator.consoleOut(), containsString("rake [-f rakefile] {options} targets..."));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 10 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildWorkTest method doWork_shouldUpdateMaterialsWhenFetchMaterialsIsTrue.

@Test
public void doWork_shouldUpdateMaterialsWhenFetchMaterialsIsTrue() throws Exception {
    buildWork = (BuildWork) getWork(WILL_PASS, PIPELINE_NAME, true, false);
    buildWork.doWork(agentIdentifier, buildRepository, artifactManipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
    assertThat(artifactManipulator.consoleOut(), containsString("Start to prepare"));
    assertThat(buildRepository.states.contains(JobState.Preparing), is(true));
    assertThat(artifactManipulator.consoleOut(), containsString("Start to update materials"));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Aggregations

AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)150 Test (org.junit.jupiter.api.Test)70 Test (org.junit.Test)52 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)35 AgentStatusChangeListener (com.thoughtworks.go.listener.AgentStatusChangeListener)29 File (java.io.File)17 RemoteInvocation (org.springframework.remoting.support.RemoteInvocation)16 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)14 Agent (com.thoughtworks.go.config.Agent)13 AgentInstruction (com.thoughtworks.go.remote.AgentInstruction)13 FakeBuildRepositoryRemote (com.thoughtworks.go.agent.testhelpers.FakeBuildRepositoryRemote)12 AgentInstance.createFromLiveAgent (com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent)11 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)11 AgentBuildingInfo (com.thoughtworks.go.server.service.AgentBuildingInfo)11 UploadEntry (com.thoughtworks.go.matchers.UploadEntry)10 ArrayList (java.util.ArrayList)10 StringContains.containsString (org.hamcrest.core.StringContains.containsString)9 AgentInstance (com.thoughtworks.go.domain.AgentInstance)8 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)8 NullAgentInstance (com.thoughtworks.go.domain.NullAgentInstance)7