summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/updater.py
diff options
context:
space:
mode:
authorPhil Wise <phil@advancedtelematic.com>2018-03-27 14:06:38 +0200
committerPhil Wise <phil@advancedtelematic.com>2018-03-27 14:06:38 +0200
commitde2b0f06546666aacf9dd2fce94e0134768c6a3b (patch)
tree178a61aca1440bce83557113485380f8ea3b36be /lib/oeqa/selftest/cases/updater.py
parent7ce65035d63107605e07ecb1d923be63ecaa1ec9 (diff)
downloadmeta-updater-de2b0f06546666aacf9dd2fce94e0134768c6a3b.tar.gz
Add SOTA client feature to enable secondary network
Also add a test for the 'primary-image'
Diffstat (limited to 'lib/oeqa/selftest/cases/updater.py')
-rw-r--r--lib/oeqa/selftest/cases/updater.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index 06884e5..e459ffb 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -548,6 +548,47 @@ class SecondaryTests(OESelftestTestCase):
548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030') 548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030')
549 self.assertEqual(retcode, 0, "Unable to connect to secondary") 549 self.assertEqual(retcode, 0, "Unable to connect to secondary")
550 550
551
552class PrimaryTests(OESelftestTestCase):
553 @classmethod
554 def setUpClass(cls):
555 super(PrimaryTests, cls).setUpClass()
556 logger = logging.getLogger("selftest")
557 logger.info('Running bitbake to build primary-image')
558 bitbake('primary-image')
559
560 def setUpLocal(self):
561 layer = "meta-updater-qemux86-64"
562 result = runCmd('bitbake-layers show-layers')
563 if re.search(layer, result.output) is None:
564 # Assume the directory layout for finding other layers. We could also
565 # make assumptions by using 'show-layers', but either way, if the
566 # layers we need aren't where we expect them, we are out of like.
567 path = os.path.abspath(os.path.dirname(__file__))
568 metadir = path + "/../../../../../"
569 self.meta_qemu = metadir + layer
570 runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu)
571 else:
572 self.meta_qemu = None
573 self.append_config('MACHINE = "qemux86-64"')
574 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
575 self.append_config('SOTA_CLIENT_FEATURES = "secondary-network"')
576 self.qemu, self.s = qemu_launch(machine='qemux86-64', imagename='primary-image')
577
578 def tearDownLocal(self):
579 qemu_terminate(self.s)
580 if self.meta_qemu:
581 runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True)
582
583 def qemu_command(self, command):
584 return qemu_send_command(self.qemu.ssh_port, command)
585
586 def test_aktualizr_present(self):
587 print('Checking aktualizr is present')
588 stdout, stderr, retcode = self.qemu_command('aktualizr --help')
589 self.assertEqual(retcode, 0, "Unable to run aktualizr --help")
590 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
591
551def qemu_launch(efi=False, machine=None, imagename=None): 592def qemu_launch(efi=False, machine=None, imagename=None):
552 logger = logging.getLogger("selftest") 593 logger = logging.getLogger("selftest")
553 logger.info('Running bitbake to build core-image-minimal') 594 logger.info('Running bitbake to build core-image-minimal')