tests: various fixes
- Use proper features/services names (updates proxy test). - Fix logic error in wait_for_window. - Fix test for qvm-sync-clock (first sync clockvm, then dom0), also fix cleanup (unset clockvm before removing it) - More fixes for asyncio usage
This commit is contained in:
parent
64c5b2c00f
commit
cbc5dbb9b1
@ -939,7 +939,7 @@ class SystemTestCase(QubesTestCase):
|
|||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(['xdotool', 'search', '--name', title],
|
while subprocess.call(['xdotool', 'search', '--name', title],
|
||||||
stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) \
|
stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) \
|
||||||
== int(show):
|
== int(not show):
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
if wait_count > timeout*10:
|
if wait_count > timeout*10:
|
||||||
self.fail("Timeout while waiting for {} window to {}".format(
|
self.fail("Timeout while waiting for {} window to {}".format(
|
||||||
|
@ -899,10 +899,9 @@ SHA256:
|
|||||||
self.netvm_repo.provides_network = True
|
self.netvm_repo.provides_network = True
|
||||||
self.loop.run_until_complete(self.netvm_repo.create_on_disk())
|
self.loop.run_until_complete(self.netvm_repo.create_on_disk())
|
||||||
self.testvm1.netvm = self.netvm_repo
|
self.testvm1.netvm = self.netvm_repo
|
||||||
# NetVM should have qubes-updates-proxy enabled by default
|
self.netvm_repo.features['service.qubes-updates-proxy'] = True
|
||||||
#self.netvm_repo.features['qubes-updates-proxy'] = True
|
|
||||||
# TODO: consider also adding a test for the template itself
|
# TODO: consider also adding a test for the template itself
|
||||||
self.testvm1.features['updates-proxy-setup'] = True
|
self.testvm1.features['service.updates-proxy-setup'] = True
|
||||||
self.app.save()
|
self.app.save()
|
||||||
|
|
||||||
# Setup test repo
|
# Setup test repo
|
||||||
@ -915,7 +914,8 @@ SHA256:
|
|||||||
|
|
||||||
# update repository metadata
|
# update repository metadata
|
||||||
p = self.loop.run_until_complete(self.testvm1.run(
|
p = self.loop.run_until_complete(self.testvm1.run(
|
||||||
self.update_cmd, user='root'))
|
self.update_cmd, user='root', stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE))
|
||||||
(stdout, stderr) = self.loop.run_until_complete(p.communicate())
|
(stdout, stderr) = self.loop.run_until_complete(p.communicate())
|
||||||
self.assertIn(self.loop.run_until_complete(p.wait()), self.exit_code_ok,
|
self.assertIn(self.loop.run_until_complete(p.wait()), self.exit_code_ok,
|
||||||
'{}: {}\n{}'.format(self.update_cmd, stdout, stderr))
|
'{}: {}\n{}'.format(self.update_cmd, stdout, stderr))
|
||||||
|
@ -751,15 +751,15 @@ class TC_00_AppVMMixin(object):
|
|||||||
self.testvm1.run_for_stdio('date -s 2001-01-01T12:34:56',
|
self.testvm1.run_for_stdio('date -s 2001-01-01T12:34:56',
|
||||||
user='root'))
|
user='root'))
|
||||||
|
|
||||||
|
self.loop.run_until_complete(
|
||||||
|
self.testvm1.run_for_stdio('qvm-sync-clock',
|
||||||
|
user='root'))
|
||||||
|
|
||||||
p = self.loop.run_until_complete(
|
p = self.loop.run_until_complete(
|
||||||
asyncio.create_subprocess_exec('sudo', 'qvm-sync-clock',
|
asyncio.create_subprocess_exec('sudo', 'qvm-sync-clock',
|
||||||
stdout=asyncio.subprocess.DEVNULL))
|
stdout=asyncio.subprocess.DEVNULL))
|
||||||
self.loop.run_until_complete(p.wait())
|
self.loop.run_until_complete(p.wait())
|
||||||
self.assertEqual(p.returncode, 0)
|
self.assertEqual(p.returncode, 0)
|
||||||
self.loop.run_until_complete(
|
|
||||||
self.testvm1.run_for_stdio('qvm-sync-clock',
|
|
||||||
user='root'))
|
|
||||||
|
|
||||||
vm_time, _ = self.loop.run_until_complete(
|
vm_time, _ = self.loop.run_until_complete(
|
||||||
self.testvm1.run_for_stdio('date -u +%s'))
|
self.testvm1.run_for_stdio('date -u +%s'))
|
||||||
self.assertAlmostEquals(int(vm_time), int(start_time), delta=30)
|
self.assertAlmostEquals(int(vm_time), int(start_time), delta=30)
|
||||||
@ -772,6 +772,8 @@ class TC_00_AppVMMixin(object):
|
|||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
["sudo", "date", "-u", "-s", "@" + start_time.decode()])
|
["sudo", "date", "-u", "-s", "@" + start_time.decode()])
|
||||||
raise
|
raise
|
||||||
|
finally:
|
||||||
|
self.app.clockvm = None
|
||||||
|
|
||||||
@unittest.expectedFailure
|
@unittest.expectedFailure
|
||||||
def test_250_resize_private_img(self):
|
def test_250_resize_private_img(self):
|
||||||
@ -894,12 +896,13 @@ int main(int argc, char **argv) {
|
|||||||
'ulimit -l unlimited; exec /home/user/allocator {}'.format(
|
'ulimit -l unlimited; exec /home/user/allocator {}'.format(
|
||||||
memory_pages),
|
memory_pages),
|
||||||
user="root",
|
user="root",
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
# wait for memory being allocated; can't use just .read(), because EOF
|
# wait for memory being allocated; can't use just .read(), because EOF
|
||||||
# passing is unreliable while the process is still running
|
# passing is unreliable while the process is still running
|
||||||
yield from alloc1.stdin.write(b'\n')
|
alloc1.stdin.write(b'\n')
|
||||||
yield from alloc1.stdin.flush()
|
yield from alloc1.stdin.drain()
|
||||||
alloc_out = yield from alloc1.stdout.read(
|
alloc_out = yield from alloc1.stdout.read(
|
||||||
len('Stage1\nStage2\nStage3\n'))
|
len('Stage1\nStage2\nStage3\n'))
|
||||||
|
|
||||||
@ -931,8 +934,8 @@ int main(int argc, char **argv) {
|
|||||||
vm_winid = xprop.decode().strip().split(' ')[4]
|
vm_winid = xprop.decode().strip().split(' ')[4]
|
||||||
|
|
||||||
# now free the fragmented memory and trigger compaction
|
# now free the fragmented memory and trigger compaction
|
||||||
yield from alloc1.stdin.write(b'\n')
|
alloc1.stdin.write(b'\n')
|
||||||
yield from alloc1.stdin.flush()
|
yield from alloc1.stdin.drain()
|
||||||
yield from alloc1.wait()
|
yield from alloc1.wait()
|
||||||
yield from self.testvm1.run_for_stdio(
|
yield from self.testvm1.run_for_stdio(
|
||||||
'echo 1 > /proc/sys/vm/compact_memory', user='root')
|
'echo 1 > /proc/sys/vm/compact_memory', user='root')
|
||||||
|
Loading…
Reference in New Issue
Block a user