use of org.jenkinsci.test.acceptance.docker.fixtures.JavaGitContainer in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method createDockerAgent.
/**
* Creates an agent in a Docker container.
*
* @return the new agent ready for new builds
*/
protected DumbSlave createDockerAgent() {
DumbSlave agent = jenkins.slaves.create(DumbSlave.class);
agent.setExecutors(1);
agent.remoteFS.set("/tmp/");
SshSlaveLauncher launcher = agent.setLauncher(SshSlaveLauncher.class);
JavaGitContainer container = getDockerContainer();
launcher.host.set(container.ipBound(22));
launcher.port(container.port(22));
launcher.setSshHostKeyVerificationStrategy(SshSlaveLauncher.NonVerifyingKeyVerificationStrategy.class);
launcher.selectCredentials(CREDENTIALS_ID);
agent.save();
agent.waitUntilOnline();
assertThat(agent.isOnline(), is(true));
return agent;
}
Aggregations