use of org.jenkinsci.test.acceptance.po.DumbSlave in project acceptance-test-harness by jenkinsci.
the class TSRCreateSlaveTest method newSlaveWithExistingCredential.
@Test
@WithPlugins("credentials@2.0.7")
public void newSlaveWithExistingCredential() throws Exception {
String username = "xyz";
String description = "SSH Key setup";
String privateKey = "1212121122121212";
CredentialsPage c = new CredentialsPage(jenkins, "_");
c.open();
SshPrivateKeyCredential sc = c.add(SshPrivateKeyCredential.class);
sc.username.set(username);
sc.description.set(description);
sc.selectEnterDirectly().privateKey.set(privateKey);
c.create();
// now verify
c.open();
ManagedCredentials mc = new ManagedCredentials(jenkins);
String href = mc.credentialById("ssh_creds");
c.setConfigUrl(href);
verifyValueForCredential(c, sc.username, username);
verifyValueForCredential(c, sc.selectEnterDirectly().privateKey, privateKey);
// Just to make sure the dumb slave is set up properly, we should seed it
// with a FS root and executors
final DumbSlave s = jenkins.slaves.create(DumbSlave.class);
SshSlaveLauncher l = s.setLauncher(SshSlaveLauncher.class);
l.host.set("127.0.0.1");
l.credentialsId.select(String.format("%s (%s)", username, description));
}
use of org.jenkinsci.test.acceptance.po.DumbSlave 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