.render(OsFamily.UNIX);
}
@Test(enabled = false, dependsOnMethods = "testCreateAndAttachVolume")
void testBundleInstance() {
SshClient ssh = sshFactory.create(HostAndPort.fromParts(instance.getIpAddress(), 22),
LoginCredentials.builder().user("ubuntu").privateKey(keyPair.getKeyMaterial()).build());
try {
ssh.connect();
} catch (SshException e) {// try twice in case there is a network timeout
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException e1) {
}
ssh.connect();
}
try {
System.out.printf("%d: %s writing ebs script%n", System.currentTimeMillis(), instance.getId());
String script = "/tmp/mkebsboot-init.sh";
ssh.put(script, Payloads.newStringPayload(mkEbsBoot));
System.out.printf("%d: %s launching ebs script%n", System.currentTimeMillis(), instance.getId());
ssh.exec("chmod 755 " + script);
ssh.exec(script + " init");
ExecResponse output = ssh.exec("sudo " + script + " start");
System.out.println(output);
output = ssh.exec(script + " status");
assert !output.getOutput().trim().equals("") : output;
Predicate<String> scriptTester = retry(new ScriptTester(ssh, SCRIPT_END), 600, 10, SECONDS);
scriptTester.apply(script);
} finally {
if (ssh != null)
ssh.disconnect();
}
}