Switch get repo API to use a single list tags query

Should make things faster since the join occurs on the database side
This commit is contained in:
Joseph Schorr 2017-04-13 16:34:14 -04:00
parent d86b0254b3
commit ab2f044331
4 changed files with 48 additions and 15 deletions

View file

@ -2425,6 +2425,24 @@ class TestDeleteRepository(ApiTestCase):
class TestGetRepository(ApiTestCase):
PUBLIC_REPO = PUBLIC_USER + '/publicrepo'
def test_get_largerepo(self):
self.login(ADMIN_ACCESS_USER)
# base + repo + is_starred + tags
with assert_query_count(BASE_LOGGEDIN_QUERY_COUNT + 4):
self.getJsonResponse(Repository,
params=dict(repository=ADMIN_ACCESS_USER + '/simple'))
# base + repo + is_starred + tags
with assert_query_count(BASE_LOGGEDIN_QUERY_COUNT + 4):
json = self.getJsonResponse(Repository,
params=dict(repository=ADMIN_ACCESS_USER + '/gargantuan'))
self.assertEquals(ADMIN_ACCESS_USER, json['namespace'])
self.assertEquals('gargantuan', json['name'])
self.assertEquals(False, json['is_public'])
def test_getrepo_badnames(self):
self.login(ADMIN_ACCESS_USER)
@ -4540,7 +4558,7 @@ class TestRepositoryImageSecurity(ApiTestCase):
expected_code=200)
class TestSuperUserCustomCertificates(ApiTestCase):
def test_custom_certificates(self):