summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py
index 08afbe6..0fac159 100644
--- a/lib/oeqa/selftest/cases/updater_qemux86_64.py
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py
@@ -424,4 +424,49 @@ class PrimaryTests(OESelftestTestCase):
424 self.assertEqual(retcode, 0, "Unable to run aktualizr --help") 424 self.assertEqual(retcode, 0, "Unable to run aktualizr --help")
425 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) 425 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
426 426
427
428class ResourceControlTests(OESelftestTestCase):
429 def setUpLocal(self):
430 layer = "meta-updater-qemux86-64"
431 result = runCmd('bitbake-layers show-layers')
432 if re.search(layer, result.output) is None:
433 # Assume the directory layout for finding other layers. We could also
434 # make assumptions by using 'show-layers', but either way, if the
435 # layers we need aren't where we expect them, we are out of luck.
436 path = os.path.abspath(os.path.dirname(__file__))
437 metadir = path + "/../../../../../"
438 self.meta_qemu = metadir + layer
439 runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu)
440 else:
441 self.meta_qemu = None
442 self.append_config('MACHINE = "qemux86-64"')
443 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
444 self.append_config('IMAGE_INSTALL_append += " aktualizr-resource-control "')
445 self.append_config('RESOURCE_CPU_WEIGHT_pn-aktualizr = "1000"')
446 self.append_config('RESOURCE_MEMORY_HIGH_pn-aktualizr = "50M"')
447 self.append_config('RESOURCE_MEMORY_MAX_pn-aktualizr = "1M"')
448 self.qemu, self.s = qemu_launch(machine='qemux86-64')
449
450 def tearDownLocal(self):
451 qemu_terminate(self.s)
452 if self.meta_qemu:
453 runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True)
454
455 def qemu_command(self, command):
456 return qemu_send_command(self.qemu.ssh_port, command)
457
458 def test_aktualizr_resource_control(self):
459 print('Checking aktualizr was killed')
460 stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show aktualizr')
461 self.assertIn(b'CPUWeight=1000', stdout, 'CPUWeight was not set correctly')
462 self.assertIn(b'MemoryHigh=52428800', stdout, 'MemoryHigh was not set correctly')
463 self.assertIn(b'MemoryMax=1048576', stdout, 'MemoryMax was not set correctly')
464 self.assertIn(b'ExecMainStatus=9', stdout, 'Aktualizr was not killed')
465
466 self.qemu_command('systemctl --runtime set-property aktualizr MemoryMax=')
467 self.qemu_command('systemctl restart aktualizr')
468
469 stdout, stderr, retcode = self.qemu_command('systemctl --no-pager show --property=ExecMainStatus aktualizr')
470 self.assertIn(b'ExecMainStatus=0', stdout, 'Aktualizr did not restart')
471
427# vim:set ts=4 sw=4 sts=4 expandtab: 472# vim:set ts=4 sw=4 sts=4 expandtab: