Merge "Fix metric names in the object_store"
This commit is contained in:
commit
8bd107bb9b
@ -69,14 +69,21 @@ class Proxy(proxy.Proxy):
|
|||||||
and url_parts[0][0] == 'v'
|
and url_parts[0][0] == 'v'
|
||||||
and url_parts[0][1] and url_parts[0][1].isdigit()):
|
and url_parts[0][1] and url_parts[0][1].isdigit()):
|
||||||
url_parts = url_parts[1:]
|
url_parts = url_parts[1:]
|
||||||
name_parts = self._extract_name_consume_url_parts(url_parts)
|
|
||||||
|
|
||||||
# Getting the root of an endpoint is doing version discovery
|
|
||||||
if not name_parts:
|
|
||||||
name_parts = ['account']
|
|
||||||
|
|
||||||
# Strip out anything that's empty or None
|
# Strip out anything that's empty or None
|
||||||
return [part for part in name_parts if part]
|
parts = [part for part in url_parts if part]
|
||||||
|
|
||||||
|
# Getting the root of an endpoint is doing version discovery
|
||||||
|
if not parts:
|
||||||
|
return ['account']
|
||||||
|
|
||||||
|
if len(parts) == 1:
|
||||||
|
if 'endpoints' in parts:
|
||||||
|
return ['endpoints']
|
||||||
|
else:
|
||||||
|
return ['container']
|
||||||
|
else:
|
||||||
|
return ['object']
|
||||||
|
|
||||||
def get_account_metadata(self):
|
def get_account_metadata(self):
|
||||||
"""Get metadata for this account.
|
"""Get metadata for this account.
|
||||||
|
@ -247,12 +247,19 @@ class TestDownloadObject(base_test_object.BaseTestObject):
|
|||||||
class TestExtractName(TestObjectStoreProxy):
|
class TestExtractName(TestObjectStoreProxy):
|
||||||
|
|
||||||
scenarios = [
|
scenarios = [
|
||||||
('discovery', dict(url='/', parts=['account']))
|
('discovery', dict(url='/', parts=['account'])),
|
||||||
|
('endpoints', dict(url='/endpoints', parts=['endpoints'])),
|
||||||
|
('container', dict(url='/AUTH_123/container_name',
|
||||||
|
parts=['container'])),
|
||||||
|
('object', dict(url='/container_name/object_name',
|
||||||
|
parts=['object'])),
|
||||||
|
('object_long', dict(url='/v1/AUTH_123/cnt/path/deep/object_name',
|
||||||
|
parts=['object']))
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_extract_name(self):
|
def test_extract_name(self):
|
||||||
|
|
||||||
results = self.proxy._extract_name(self.url)
|
results = self.proxy._extract_name(self.url, project_id='123')
|
||||||
self.assertEqual(self.parts, results)
|
self.assertEqual(self.parts, results)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user