Created
September 29, 2012 20:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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--