summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-07-09 12:06:22 +0200
committerMykhaylo Sul <ext-mykhaylo.sul@here.com>2019-07-17 16:02:34 +0300
commit3e4fc36c8dc5ee44e02a7c3e6fcbda2a4716c5a8 (patch)
tree335689383d80c05f4df28b891ee0610a67e41e15
parent9fe3bfe936a5b0196cce7583dfcb2c5cc05ac81c (diff)
downloadmeta-updater-3e4fc36c8dc5ee44e02a7c3e6fcbda2a4716c5a8.tar.gz
Fix some oe-selftest timeouts issues
Was causing problems on CI Signed-off-by: Laurent Bonnans <laurent.bonnans@here.com>
-rw-r--r--lib/oeqa/selftest/cases/testutils.py2
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64.py18
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py
index e67f30c..208f822 100644
--- a/lib/oeqa/selftest/cases/testutils.py
+++ b/lib/oeqa/selftest/cases/testutils.py
@@ -61,7 +61,7 @@ def qemu_bake_image(imagename):
61 bitbake(imagename) 61 bitbake(imagename)
62 62
63 63
64def qemu_send_command(port, command, timeout=60): 64def qemu_send_command(port, command, timeout=120):
65 command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' + 65 command = ['ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost -p ' +
66 str(port) + ' "' + command + '"'] 66 str(port) + ' "' + command + '"']
67 s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 67 s2 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py
index f09aa46..d3a5523 100644
--- a/lib/oeqa/selftest/cases/updater_qemux86_64.py
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py
@@ -2,6 +2,7 @@
2import os 2import os
3import logging 3import logging
4import re 4import re
5import subprocess
5import unittest 6import unittest
6from time import sleep 7from time import sleep
7from uuid import uuid4 8from uuid import uuid4
@@ -307,8 +308,8 @@ class IpSecondaryTests(OESelftestTestCase):
307 self.configure() 308 self.configure()
308 qemu_bake_image(self.imagename) 309 qemu_bake_image(self.imagename)
309 310
310 def send_command(self, cmd): 311 def send_command(self, cmd, timeout=60):
311 stdout, stderr, retcode = qemu_send_command(self.qemu.ssh_port, cmd, timeout=60) 312 stdout, stderr, retcode = qemu_send_command(self.qemu.ssh_port, cmd, timeout=timeout)
312 return str(stdout), str(stderr), retcode 313 return str(stdout), str(stderr), retcode
313 314
314 def __enter__(self): 315 def __enter__(self):
@@ -323,7 +324,7 @@ class IpSecondaryTests(OESelftestTestCase):
323 def wait_till_sshable(self): 324 def wait_till_sshable(self):
324 # qemu_send_command tries to ssh into the qemu VM and blocks until it gets there or timeout happens 325 # qemu_send_command tries to ssh into the qemu VM and blocks until it gets there or timeout happens
325 # so it helps us to block q control flow until the VM is booted and a target binary/daemon is running there 326 # so it helps us to block q control flow until the VM is booted and a target binary/daemon is running there
326 self.stdout, self.stderr, self.retcode = self.send_command(self.binaryname + ' --help') 327 self.stdout, self.stderr, self.retcode = self.send_command(self.binaryname + ' --help', timeout=300)
327 328
328 def was_successfully_booted(self): 329 def was_successfully_booted(self):
329 return self.retcode == 0 330 return self.retcode == 0
@@ -445,10 +446,13 @@ class ResourceControlTests(OESelftestTestCase):
445 ran_ok = False 446 ran_ok = False
446 for delay in [5, 5, 5, 5]: 447 for delay in [5, 5, 5, 5]:
447 sleep(delay) 448 sleep(delay)
448 stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show aktualizr') 449 try:
449 if retcode == 0 and b'ExecMainStatus=9' in stdout: 450 stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show aktualizr')
450 ran_ok = True 451 if retcode == 0 and b'ExecMainStatus=9' in stdout:
451 break 452 ran_ok = True
453 break
454 except subprocess.TimeoutExpired:
455 pass
452 self.assertTrue(ran_ok, 'Aktualizr was not killed') 456 self.assertTrue(ran_ok, 'Aktualizr was not killed')
453 457
454 self.assertIn(b'CPUWeight=1000', stdout, 'CPUWeight was not set correctly') 458 self.assertIn(b'CPUWeight=1000', stdout, 'CPUWeight was not set correctly')