@Test( dependsOnMethods = { "testAddPublicKey", "testAllocateIpAddress", "testCreateVolume", "resolveImageAndInstanceType" }) public void testCreateInstanceWithIpAndVolume() throws Exception { String name = TAG + "1"; killInstance(name); instance2 = connection.createInstanceInLocation( location.getId(), name, image.getId(), instanceType.getId(), attachIp(ip.getId()) .authorizePublicKey(key.getName()) .mountVolume(volume.getId(), "/mnt")); assertBeginState(instance2, name); assertIpHostAndStatusNEW(instance2); blockUntilRunning(instance2); instance2 = assertRunning(instance2, name); volume = connection.getVolume(volume.getId()); assertEquals(volume.getInstanceId(), instance2.getId()); refreshIpAndReturnAllAddresses(); assertEquals(ip.getInstanceId(), instance2.getId()); assertEquals(ip.getIp(), instance2.getIp()); sshAndDf( new IPSocket(instance2.getIp(), 22), new Credentials("idcuser", keyPair.get("private"))); }
private void assertConsistent(Instance instance, String name) { assertNotNull(instance.getId()); assertEquals(instance.getName(), name); assertEquals(instance.getInstanceType(), instanceType.getId()); assertEquals(instance.getLocation(), location.getId()); assertEquals(instance.getImageId(), image.getId()); assertEquals(instance.getSoftware(), SOFTWARE); assertEquals(instance.getKeyName(), key.getName()); assertNotNull(instance.getLaunchTime()); assertNotNull(instance.getExpirationTime()); assertEquals(instance.getOwner(), identity); assertEquals(instance.getProductCodes(), ImmutableSet.<String>of()); assertEquals(instance.getRequestName(), name); assertNotNull(instance.getRequestId()); }
@Test(dependsOnMethods = {"testAddPublicKey", "resolveImageAndInstanceType"}) public void testCreateInstance() throws Exception { killInstance(TAG); instance = connection.createInstanceInLocation( location.getId(), TAG, image.getId(), instanceType.getId(), authorizePublicKey(key.getName())); assertBeginState(instance, TAG); assertIpHostNullAndStatusNEW(instance); blockUntilRunning(instance); instance = assertRunning(instance, TAG); sshAndDf(new IPSocket(instance.getIp(), 22), new Credentials("idcuser", key.getKeyMaterial())); }