Skip to content

Instantly share code, notes, and snippets.

@jclouds
Created September 29, 2012 20:06
Show Gist options
  • Save jclouds/3805063 to your computer and use it in GitHub Desktop.
Save jclouds/3805063 to your computer and use it in GitHub Desktop.
expect test for when nova doesn't match an api version in keystone
Here's the critical part of the keystone response:
"serviceCatalog": [{
"endpoints": [{
"adminURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"region": "RegionOne",
"internalURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"id": "bb3ce9ccdc5045909882688b90cc3ff0",
"publicURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317"
}],
"endpoints_links": [],
"type": "compute",
"name": "nova"
},
@Test(groups = "unit", testName = "OverrideApiVersionExpectTest")
public class OverrideApiVersionExpectTest extends BaseNovaApiExpectTest {
public OverrideApiVersionExpectTest() {
this.identity = "demo:demo";
this.credential = "password";
}
@Override
protected Properties setupProperties() {
Properties overrides = super.setupProperties();
overrides.setProperty(Constants.PROPERTY_ENDPOINT, "http://10.10.10.10:5000/v2.0/");
overrides.setProperty(provider + ".api-version", "bb3ce9ccdc5045909882688b90cc3ff0");
return overrides;
}
public void testVersionMatchOnConfiguredZonesWhenResponseIs2xx() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("http://10.10.10.10:5000/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"passwordCredentials\":{\"username\":\"demo\",\"password\":\"password\"},\"tenantName\":\"demo\"}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/access_version_uids.json", "application/json")).build();
NovaApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("RegionOne"));
}
}
@jclouds
Copy link
Author

jclouds commented Sep 29, 2012

Here's the critical part of the keystone response:

--snip--
"serviceCatalog": [{
"endpoints": [{
"adminURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"region": "RegionOne",
"internalURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"id": "bb3ce9ccdc5045909882688b90cc3ff0",
"publicURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317"
}],
"endpoints_links": [],
"type": "compute",
"name": "nova"
},
--snip--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment