Skip to content

Commit

Permalink
tests: extend TestPool storage driver to make create_on_disk working
Browse files Browse the repository at this point in the history
Add dummy TestVolume with empty create() method. Other core code
requires also TestPool.get_volume implemented, so add that too (naive
version remembering instances returned from TestPool.init_volume).
  • Loading branch information
marmarek committed Jul 8, 2020
1 parent d9d55b0 commit 410a072
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion qubes/tests/vm/appvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,24 @@ def __init__(self, **kwargs):
def is_running(self):
return self.running

class TestVolume(qubes.storage.Volume):
def create(self):
pass

class TestPool(qubes.storage.Pool):
def __init__(self, *args, **kwargs):
super(TestPool, self).__init__(*args, **kwargs)
self._volumes = {}

def init_volume(self, vm, volume_config):
vid = '{}/{}'.format(vm.name, volume_config['name'])
assert volume_config.pop('pool', None) == self
return qubes.storage.Volume(vid=vid, pool=self, **volume_config)
vol = TestVolume(vid=vid, pool=self, **volume_config)
self._volumes[vid] = vol
return vol

def get_volume(self, vid):
return self._volumes[vid]


class TC_90_AppVM(qubes.tests.vm.qubesvm.QubesVMTestsMixin,
Expand Down

0 comments on commit 410a072

Please sign in to comment.