tests/backup: use smaller images
This will be less realistic (private.img of 2MB?!), but makes tests much quicker. And since tar is used to make files sparse, we don't really test multi-part archives anyway.
This commit is contained in:
parent
a91372a919
commit
525f8dc7f3
@ -315,7 +315,7 @@ parsed_qubes_xml_r2 = {
|
|||||||
'template': None,
|
'template': None,
|
||||||
'backup_path': 'appvms/test-testhvm',
|
'backup_path': 'appvms/test-testhvm',
|
||||||
'included_in_backup': True,
|
'included_in_backup': True,
|
||||||
'root_size': 209715712,
|
'root_size': 2097664,
|
||||||
},
|
},
|
||||||
'test-work': {
|
'test-work': {
|
||||||
'klass': 'AppVM',
|
'klass': 'AppVM',
|
||||||
@ -360,7 +360,7 @@ parsed_qubes_xml_r2 = {
|
|||||||
'template': None,
|
'template': None,
|
||||||
'backup_path': 'appvms/test-standalonevm',
|
'backup_path': 'appvms/test-standalonevm',
|
||||||
'included_in_backup': True,
|
'included_in_backup': True,
|
||||||
'root_size': 209715712,
|
'root_size': 2097664,
|
||||||
},
|
},
|
||||||
'test-net': {
|
'test-net': {
|
||||||
'klass': 'AppVM',
|
'klass': 'AppVM',
|
||||||
@ -512,11 +512,11 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
|
|
||||||
def create_private_img(self, filename):
|
def create_private_img(self, filename):
|
||||||
signature = '/'.join(os.path.splitext(filename)[0].split('/')[-2:])
|
signature = '/'.join(os.path.splitext(filename)[0].split('/')[-2:])
|
||||||
self.create_sparse(filename, 2*2**30, signature=signature.encode())
|
self.create_sparse(filename, 2*2**20, signature=signature.encode())
|
||||||
#subprocess.check_call(["/usr/sbin/mkfs.ext4", "-q", "-F", filename])
|
#subprocess.check_call(["/usr/sbin/mkfs.ext4", "-q", "-F", filename])
|
||||||
|
|
||||||
def create_volatile_img(self, filename):
|
def create_volatile_img(self, filename):
|
||||||
self.create_sparse(filename, 11.5*2**30)
|
self.create_sparse(filename, 11.5*2**20)
|
||||||
# here used to be sfdisk call with "0,1024,S\n,10240,L\n" input,
|
# here used to be sfdisk call with "0,1024,S\n,10240,L\n" input,
|
||||||
# but since sfdisk folks like to change command arguments in
|
# but since sfdisk folks like to change command arguments in
|
||||||
# incompatible way, have an partition table verbatim here
|
# incompatible way, have an partition table verbatim here
|
||||||
@ -566,7 +566,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
self.create_sparse(
|
self.create_sparse(
|
||||||
self.fullpath("appvms/test-standalonevm/root.img"), 10*2**30)
|
self.fullpath("appvms/test-standalonevm/root.img"), 10*2**30)
|
||||||
self.fill_image(self.fullpath("appvms/test-standalonevm/root.img"),
|
self.fill_image(self.fullpath("appvms/test-standalonevm/root.img"),
|
||||||
100*1024*1024, True,
|
1024*1024, True,
|
||||||
signature=b'test-standalonevm/root')
|
signature=b'test-standalonevm/root')
|
||||||
os.mkdir(self.fullpath("appvms/test-standalonevm/apps.templates"))
|
os.mkdir(self.fullpath("appvms/test-standalonevm/apps.templates"))
|
||||||
self.create_appmenus(self.fullpath("appvms/test-standalonevm/apps"
|
self.create_appmenus(self.fullpath("appvms/test-standalonevm/apps"
|
||||||
@ -576,7 +576,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
os.mkdir(self.fullpath("appvms/test-standalonevm/kernels"))
|
os.mkdir(self.fullpath("appvms/test-standalonevm/kernels"))
|
||||||
for k_file in ["initramfs", "vmlinuz", "modules.img"]:
|
for k_file in ["initramfs", "vmlinuz", "modules.img"]:
|
||||||
self.fill_image(self.fullpath("appvms/test-standalonevm/kernels/"
|
self.fill_image(self.fullpath("appvms/test-standalonevm/kernels/"
|
||||||
+ k_file), 10*1024*1024)
|
+ k_file), 1024*1024)
|
||||||
|
|
||||||
# VM based on custom template
|
# VM based on custom template
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
@ -595,7 +595,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
self.create_private_img(
|
self.create_private_img(
|
||||||
self.fullpath("appvms/test-testhvm/private.img"))
|
self.fullpath("appvms/test-testhvm/private.img"))
|
||||||
self.fill_image(self.fullpath("appvms/test-testhvm/root.img"),
|
self.fill_image(self.fullpath("appvms/test-testhvm/root.img"),
|
||||||
100*1024*1024, True,
|
1024*1024, True,
|
||||||
signature=b'test-testhvm/root')
|
signature=b'test-testhvm/root')
|
||||||
|
|
||||||
# ProxyVM
|
# ProxyVM
|
||||||
@ -617,11 +617,11 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
self.create_private_img(
|
self.create_private_img(
|
||||||
self.fullpath("vm-templates/test-template-clone/private.img"))
|
self.fullpath("vm-templates/test-template-clone/private.img"))
|
||||||
self.create_sparse(self.fullpath(
|
self.create_sparse(self.fullpath(
|
||||||
"vm-templates/test-template-clone/root-cow.img"), 10*2**30)
|
"vm-templates/test-template-clone/root-cow.img"), 10*2**20)
|
||||||
self.create_sparse(self.fullpath(
|
self.create_sparse(self.fullpath(
|
||||||
"vm-templates/test-template-clone/root.img"), 10*2**30)
|
"vm-templates/test-template-clone/root.img"), 10*2**20)
|
||||||
self.fill_image(self.fullpath(
|
self.fill_image(self.fullpath(
|
||||||
"vm-templates/test-template-clone/root.img"), 1*2**30, True,
|
"vm-templates/test-template-clone/root.img"), 1*2**20, True,
|
||||||
signature=b'test-template-clone/root')
|
signature=b'test-template-clone/root')
|
||||||
self.create_volatile_img(self.fullpath(
|
self.create_volatile_img(self.fullpath(
|
||||||
"vm-templates/test-template-clone/volatile.img"))
|
"vm-templates/test-template-clone/volatile.img"))
|
||||||
@ -827,7 +827,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
b'revisions_to_keep=3\n'
|
b'revisions_to_keep=3\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
(name, 'admin.vm.volume.Resize', 'root',
|
(name, 'admin.vm.volume.Resize', 'root',
|
||||||
str(vm.get('root_size', 2147484160)).encode())] = \
|
str(vm.get('root_size', 2097664)).encode())] = \
|
||||||
b'0\0'
|
b'0\0'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
(name, 'admin.vm.volume.Import', 'root',
|
(name, 'admin.vm.volume.Import', 'root',
|
||||||
@ -846,7 +846,7 @@ class TC_10_BackupCompatibility(qubesadmin.tests.backup.BackupTestCase):
|
|||||||
b'save_on_stop=True\n' \
|
b'save_on_stop=True\n' \
|
||||||
b'revisions_to_keep=3\n'
|
b'revisions_to_keep=3\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
(name, 'admin.vm.volume.Resize', 'private', b'2147483648')] = \
|
(name, 'admin.vm.volume.Resize', 'private', b'2097152')] = \
|
||||||
b'0\0'
|
b'0\0'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
(name, 'admin.vm.volume.Import', 'private',
|
(name, 'admin.vm.volume.Import', 'private',
|
||||||
|
Loading…
Reference in New Issue
Block a user