commit
dc1f6c2d87
11 changed files with 193 additions and 115 deletions
Binary file not shown.
|
@ -56,6 +56,6 @@ up_postgres
|
|||
|
||||
echo '> Running Full Test Suite (postgres)'
|
||||
set +e
|
||||
run_tests "postgresql://postgres@127.0.0.1/genschema"
|
||||
run_tests "postgresql://postgres@192.168.99.100/genschema"
|
||||
set -e
|
||||
down_postgres
|
||||
|
|
|
@ -973,6 +973,43 @@ class V1PullV2PushRegistryTests(V1RegistryPullMixin, V2RegistryPushMixin, Regist
|
|||
class VerbTests(RegistryTestCaseMixin, V1RegistryPushMixin, LiveServerTestCase):
|
||||
""" Tests for registry verbs. """
|
||||
|
||||
def get_squashed_image(self):
|
||||
response = self.conduct('GET', '/c1/squash/devtable/newrepo/latest', auth='sig')
|
||||
tar = tarfile.open(fileobj=StringIO(response.content))
|
||||
return tar
|
||||
|
||||
def test_squashed_changes(self):
|
||||
initial_images = [
|
||||
{
|
||||
'id': 'initialid',
|
||||
'contents': 'the initial image',
|
||||
},
|
||||
]
|
||||
|
||||
# Create the repo.
|
||||
self.do_push('devtable', 'newrepo', 'devtable', 'password', images=initial_images)
|
||||
initial_image_id = '91081df45b58dc62dd207441785eef2b895f0383fbe601c99a3cf643c79957dc'
|
||||
|
||||
# Pull the squashed version of the tag.
|
||||
tar = self.get_squashed_image()
|
||||
self.assertTrue(initial_image_id in tar.getnames())
|
||||
|
||||
# Change the images.
|
||||
updated_images = [
|
||||
{
|
||||
'id': 'updatedid',
|
||||
'contents': 'the updated image',
|
||||
},
|
||||
]
|
||||
|
||||
self.do_push('devtable', 'newrepo', 'devtable', 'password', images=updated_images)
|
||||
updated_image_id = '38df4bd4cdffc6b7d656dbd2813c73e864f2d362ad887c999ac315224ad281ac'
|
||||
|
||||
# Pull the squashed version of the tag and ensure it has changed.
|
||||
tar = self.get_squashed_image()
|
||||
self.assertTrue(updated_image_id in tar.getnames())
|
||||
|
||||
|
||||
def test_multilayer_squashing(self):
|
||||
images = [
|
||||
{
|
||||
|
@ -990,9 +1027,6 @@ class VerbTests(RegistryTestCaseMixin, V1RegistryPushMixin, LiveServerTestCase):
|
|||
self.do_push('devtable', 'newrepo', 'devtable', 'password', images=images)
|
||||
|
||||
# Pull the squashed version of the tag.
|
||||
response = self.conduct('GET', '/c1/squash/devtable/newrepo/latest', auth='sig')
|
||||
tar = tarfile.open(fileobj=StringIO(response.content))
|
||||
|
||||
expected_image_id = 'bd590ae79fba5ebc6550aaf016c0bd0f49b1d78178e0f83e0ca1c56c2bb7e7bf'
|
||||
|
||||
expected_names = ['repositories',
|
||||
|
@ -1001,6 +1035,7 @@ class VerbTests(RegistryTestCaseMixin, V1RegistryPushMixin, LiveServerTestCase):
|
|||
'%s/VERSION' % expected_image_id,
|
||||
'%s/layer.tar' % expected_image_id]
|
||||
|
||||
tar = self.get_squashed_image()
|
||||
self.assertEquals(expected_names, tar.getnames())
|
||||
self.assertEquals('1.0', tar.extractfile(tar.getmember('%s/VERSION' % expected_image_id)).read())
|
||||
|
||||
|
|
|
@ -1568,9 +1568,9 @@ class TestDeleteRepository(ApiTestCase):
|
|||
# Create some repository action count entries.
|
||||
RepositoryActionCount.create(repository=repository, date=datetime.datetime.now(), count=1)
|
||||
RepositoryActionCount.create(repository=repository,
|
||||
date=datetime.datetime.now() - datetime.timedelta(days=1), count=2)
|
||||
date=datetime.datetime.now() - datetime.timedelta(days=2), count=2)
|
||||
RepositoryActionCount.create(repository=repository,
|
||||
date=datetime.datetime.now() - datetime.timedelta(days=3), count=6)
|
||||
date=datetime.datetime.now() - datetime.timedelta(days=5), count=6)
|
||||
|
||||
# Delete the repository.
|
||||
self.deleteResponse(Repository, params=dict(repository=self.COMPLEX_REPO))
|
||||
|
|
|
@ -40,8 +40,8 @@ class TestGarbageCollection(unittest.TestCase):
|
|||
image.storage.save()
|
||||
|
||||
# Create derived images as well.
|
||||
for i in range(0, 2):
|
||||
model.storage.find_or_create_derived_storage(image.storage, 'squash', preferred)
|
||||
model.image.find_or_create_derived_storage(image, 'squash', preferred)
|
||||
model.image.find_or_create_derived_storage(image, 'aci', preferred)
|
||||
|
||||
# Add some additional placements to the image.
|
||||
for location_name in ['local_eu']:
|
||||
|
|
Reference in a new issue