wrapInInitScript(false).runAsRoot(false).overrideLoginCredentials(good)).entrySet()) {
checkResponseEqualsHostname(response.getValue(), response.getKey());
}
// test single-node execution
ExecResponse response = client.runScriptOnNode(node.getId(), "hostname",
wrapInInitScript(false).runAsRoot(false));
checkResponseEqualsHostname(response, node);
OperatingSystem os = node.getOperatingSystem();
// test bad password
tryBadPassword(group, good);
runScriptWithCreds(group, os, good);
checkNodes(nodes, group, "runScriptWithCreds");
// test adding AdminAccess later changes the default boot user, in this
// case to foo, with home dir /over/ridden/foo
ListenableFuture<ExecResponse> future = client.submitScriptOnNode(node.getId(), AdminAccess.builder()
.adminUsername("foo").adminHome("/over/ridden/foo").build(), nameTask("adminUpdate"));
response = future.get(3, TimeUnit.MINUTES);
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
node = client.getNodeMetadata(node.getId());
// test that the node updated to the correct admin user!
assertEquals(node.getCredentials().identity, "foo");
assert node.getCredentials().credential != null : nodes;
weCanCancelTasks(node);
assert response.getExitStatus() == 0 : node.getId() + ": " + response;
response = client.runScriptOnNode(node.getId(), "echo $USER", wrapInInitScript(false).runAsRoot(false));
assert response.getOutput().trim().equals("foo") : node.getId() + ": " + response;
} finally {
client.destroyNodesMatching(inGroup(group));
}
}