serversToDeleteAfterTheTests.add(nameOfServer);
Set<Ip> availableIps = api.getIpServices().getUnassignedIpList();
Ip availableIp = Iterables.getLast(availableIps);
Server createdServer = api.getServerServices().addServer(nameOfServer,
"GSI-f8979644-e646-4711-ad58-d98a5fa3612c", "1", availableIp.getIp());
assertNotNull(createdServer);
assert serverLatestJobCompleted.apply(createdServer);
// get server by name
Set<Server> response = api.getServerServices().getServersByName(nameOfServer);
assert response.size() == 1;
createdServer = Iterables.getOnlyElement(response);
Map<String, Credentials> credsMap = api.getServerServices().getServerCredentialsList();
LoginCredentials instanceCredentials = LoginCredentials.fromCredentials(credsMap.get(createdServer.getName()));
assertNotNull(instanceCredentials);
HostAndPort socket = HostAndPort.fromParts(createdServer.getIp().getIp(), 22);
SocketOpen socketOpen = Guice.createInjector().getInstance(SocketOpen.class);
Predicate<HostAndPort> socketTester = retry(socketOpen, 180, 5, SECONDS);
socketTester.apply(socket);
// check that the get credentials call is the same as this
assertEquals(api.getServerServices().getServerCredentials(createdServer.getId()), instanceCredentials);
try {
assertEquals(api.getServerServices().getServerCredentials(Long.MAX_VALUE), null);
} catch (AssertionError e) {
e.printStackTrace();