@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
public void testRemoveHost() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action"); HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).method("POST") .payload(payloadFromStringWithContentType("{\"remove_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get(); assertEquals(api.removeHost("1", "ubuntu"), exampleHostAggregate()); }
public void testRemoveHost() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-aggregates/1/action"); HostAggregateApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).method("POST") .payload(payloadFromStringWithContentType("{\"remove_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host_aggregate_details.json")).build()).getHostAggregateApi("az-1.region-a.geo-1").get(); assertEquals(api.removeHost("1", "ubuntu"), exampleHostAggregate()); }