示例#1
0
func (s *cinderVolumeSourceSuite) TestGetVolumeEndpointMissing(c *gc.C) {
	client := testEndpointResolver{}
	url, err := openstack.GetVolumeEndpointURL(client, "east")
	c.Assert(err, gc.ErrorMatches, `endpoint "volume" in region "east" not found`)
	c.Assert(err, jc.Satisfies, errors.IsNotFound)
	c.Assert(url, gc.IsNil)
}
示例#2
0
func (s *cinderVolumeSourceSuite) TestGetVolumeEndpointBadURL(c *gc.C) {
	client := testEndpointResolver{regionEndpoints: map[string]identity.ServiceURLs{
		"north": map[string]string{"volumev2": "some %4"},
	}}
	url, err := openstack.GetVolumeEndpointURL(client, "north")
	c.Assert(err, gc.ErrorMatches, `parse some %4: .*`)
	c.Assert(url, gc.IsNil)
}
示例#3
0
func (s *cinderVolumeSourceSuite) TestGetVolumeEndpointVolumeV2(c *gc.C) {
	client := testEndpointResolver{regionEndpoints: map[string]identity.ServiceURLs{
		"west": map[string]string{"volumev2": "http://cinder.testing/v2"},
	}}
	url, err := openstack.GetVolumeEndpointURL(client, "west")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(url.String(), gc.Equals, "http://cinder.testing/v2")
}