Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 3fcd90e

Browse files
committed
Merge pull request #553 from docker/486-get-tags
Fixed get_tags whe using storage_path
2 parents afaf33c + e93f6e0 commit 3fcd90e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

docker_registry/tags.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def get_tags(namespace, repository):
7070
if not full_tag_name.startswith('tag_'):
7171
continue
7272
tag_name = full_tag_name[4:]
73-
tag_content = store.get_content(fname)
73+
tag_content = store.get_content(
74+
store.tag_path(namespace, repository, tag_name)
75+
)
7476
yield (tag_name, tag_content)
7577

7678

tests/test_s3.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,28 @@ def test_debug_key(self):
112112

113113
# We don't call self._storage.remove(filename) here to ensure tearDown
114114
# cleanup properly and that other tests keep running as expected.
115+
116+
# Validation test for docker-index#486
117+
def test_get_tags(self):
118+
store = self._storage
119+
store._root_path = 'my/custom/path'
120+
store._init_path()
121+
assert store._root_path == 'my/custom/path'
122+
tag_path = store.tag_path('test', 'test', '0.0.2')
123+
store.put_content(tag_path, 'randomdata')
124+
tags_path = store.tag_path('test', 'test')
125+
for fname in store.list_directory(tags_path):
126+
full_tag_name = fname.split('/').pop()
127+
if not full_tag_name == 'tag_0.0.2':
128+
continue
129+
try:
130+
store.get_content(fname)
131+
except exceptions.FileNotFoundError:
132+
pass
133+
except Exception as e:
134+
raise e
135+
else:
136+
assert False
137+
138+
tag_content = store.get_content(tag_path)
139+
assert tag_content == 'randomdata'

0 commit comments

Comments
 (0)