Issue 487: terremark hostnames are predictable

This commit is contained in:
Adrian Cole 2011-07-24 00:06:38 +10:00
parent 6b9c68039b
commit f42b550015
1 changed files with 11 additions and 10 deletions

View File

@ -247,26 +247,27 @@ public abstract class BaseComputeServiceLiveTest {
Credentials good = node.getCredentials(); Credentials good = node.getCredentials();
assert good.identity != null : nodes; assert good.identity != null : nodes;
assert good.credential != null : nodes; assert good.credential != null : nodes;
OperatingSystem os = node.getOperatingSystem();
try {
Map<? extends NodeMetadata, ExecResponse> responses = runScriptWithCreds(group, os, new Credentials(
good.identity, "romeo"));
assert false : "shouldn't pass with a bad password\n" + responses;
} catch (RunScriptOnNodesException e) {
assert getRootCause(e).getMessage().contains("Auth fail") : e;
}
for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching( for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
runningInGroup(group), Statements.exec("hostname"), runningInGroup(group), Statements.exec("hostname"),
overrideCredentialsWith(good).wrapInInitScript(false).runAsRoot(false)).entrySet()){ overrideCredentialsWith(good).wrapInInitScript(false).runAsRoot(false)).entrySet()){
checkResponseEqualsHostname(response.getValue(), response.getKey()); checkResponseEqualsHostname(response.getValue(), response.getKey());
} }
// test single-node execution // test single-node execution
ExecResponse response = client.runScriptOnNode(node.getId(), "hostname", wrapInInitScript(false) ExecResponse response = client.runScriptOnNode(node.getId(), "hostname", wrapInInitScript(false)
.runAsRoot(false)); .runAsRoot(false));
checkResponseEqualsHostname(response, node); checkResponseEqualsHostname(response, node);
OperatingSystem os = node.getOperatingSystem();
// test bad password
try {
Map<? extends NodeMetadata, ExecResponse> responses = runScriptWithCreds(group, os, new Credentials(
good.identity, "romeo"));
assert responses.size() == 0 : "shouldn't pass with a bad password\n" + responses;
} catch (RunScriptOnNodesException e) {
assert getRootCause(e).getMessage().contains("Auth fail") : e;
}
runScriptWithCreds(group, os, good); runScriptWithCreds(group, os, good);