private void assertSSDDiskEquals(Disk result) { assertEquals(result.name(), SSD_DISK_NAME); assertEquals(result.sizeGb(), SIZE_GB); assertEquals(result.zone(), getDefaultZoneUrl()); assertEquals(result.type(), getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd")); } }
public void testCreatePreemptibleNodeWithSsd() throws Exception { String group = this.group + "ssd"; try { TemplateOptions options = client.templateOptions(); options.as(GoogleComputeEngineTemplateOptions.class).bootDiskType("pd-ssd").preemptible(true); // create a node Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, options); assertEquals(nodes.size(), 1, "One node should have been created"); // Verify the disk on the instance is an ssd. NodeMetadata node = Iterables.get(nodes, 0); GoogleComputeEngineApi api = client.getContext().unwrapApi(GoogleComputeEngineApi.class); Instance instance = api.instancesInZone(node.getLocation().getId()).get(node.getName()); Disk disk = api.disksInZone(node.getLocation().getId()).get(toName(instance.disks().get(0).source())); assertTrue(disk.type().toString().endsWith("pd-ssd")); assertTrue(instance.scheduling().preemptible()); } finally { client.destroyNodesMatching(inGroup(group)); } } /**