tests: add qdb_watch test

Use dom0 instance of QubesDB, to be independent of working (or not) VMs
at this stage.

QubesOS/qubes-issues#2940
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-25 05:18:43 +02:00
parent 67c382c8b0
commit 1933a720d0
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -65,6 +65,20 @@ class TC_00_Basic(qubes.tests.SystemTestCase):
with self.assertNotRaises(qubes.exc.QubesException):
vm.storage.verify()
def test_040_qdb_watch(self):
flag = set()
def handler(vm, event, path):
if path == '/test-watch-path':
flag.add(True)
vm = self.app.domains[0]
vm.watch_qdb_path('/test-watch-path')
vm.add_handler('domain-qdb-change:/test-watch-path', handler)
self.assertFalse(flag)
vm.untrusted_qdb.write('/test-watch-path', 'test-value')
self.loop.run_until_complete(asyncio.sleep(0.1))
self.assertTrue(flag)
class TC_01_Properties(qubes.tests.SystemTestCase):
# pylint: disable=attribute-defined-outside-init