@Test(dependsOnMethods = "testCreateVolumeInAvailabilityZone") void testCreateSnapshotInRegion() { Snapshot snapshot = client.createSnapshotInRegion(defaultRegion, volumeId); Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(client), 600, 10, SECONDS); assert snapshotted.apply(snapshot); Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(defaultRegion, snapshotIds(snapshot.getId()))); assertEquals(result.getProgress(), 100); this.snapshot = result; }
@Test(dependsOnMethods = "testCreateVolumeInAvailabilityZone") void testCreateSnapshotInRegion() { Snapshot snapshot = client.createSnapshotInRegion(defaultRegion, volumeId); Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(client), 600, 10, SECONDS); assert snapshotted.apply(snapshot); Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(), snapshotIds(snapshot.getId()))); assertEquals(result.getProgress(), 100); this.snapshot = result; }
protected Snapshot createSnapshot() throws RunNodesException { String instanceId = null; try { RunningInstance instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().runInstancesInRegion( regionId, null, imageId, 1, 1))); instanceId = instance.getId(); assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!"); instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().describeInstancesInRegion(regionId, instanceId))); BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1"); assertNotNull(device, "device: /dev/sda1 not present on: " + instance); Snapshot snapshot = ec2Api.getElasticBlockStoreApi().get().createSnapshotInRegion(regionId, device.getVolumeId()); snapshotsToDelete.add(snapshot.getId()); Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(ec2Api.getElasticBlockStoreApi().get()), 600, 10, SECONDS); assert snapshotted.apply(snapshot); return snapshot; } finally { if (instanceId != null) ec2Api.getInstanceApi().get().terminateInstancesInRegion(regionId, instanceId); } }
device.getVolumeId()); snapshotsToDelete.add(snapshot.getId()); Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(ec2Api.getElasticBlockStoreApi().get()), 600, 10, SECONDS); assert snapshotted.apply(snapshot); return snapshot;