summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/selftest/cases/updater.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/selftest/cases/updater.py')
-rw-r--r--lib/oeqa/selftest/cases/updater.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index 190d85d..ed4d8d7 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -193,6 +193,49 @@ class AutoProvTests(OESelftestTestCase):
193 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode()) 193 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode())
194 194
195 195
196class ManualControlTests(OESelftestTestCase):
197
198 def setUpLocal(self):
199 layer = "meta-updater-qemux86-64"
200 result = runCmd('bitbake-layers show-layers')
201 if re.search(layer, result.output) is None:
202 # Assume the directory layout for finding other layers. We could also
203 # make assumptions by using 'show-layers', but either way, if the
204 # layers we need aren't where we expect them, we are out of like.
205 path = os.path.abspath(os.path.dirname(__file__))
206 metadir = path + "/../../../../../"
207 self.meta_qemu = metadir + layer
208 runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu)
209 else:
210 self.meta_qemu = None
211 self.append_config('MACHINE = "qemux86-64"')
212 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
213 self.append_config('SYSTEMD_AUTO_ENABLE_aktualizr = "disable"')
214 self.qemu, self.s = qemu_launch(machine='qemux86-64')
215
216 def tearDownLocal(self):
217 qemu_terminate(self.s)
218 if self.meta_qemu:
219 runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True)
220
221 def qemu_command(self, command):
222 return qemu_send_command(self.qemu.ssh_port, command)
223
224 def test_manual_running_mode_once(self):
225 """
226 Disable the systemd service then run aktualizr manually
227 """
228 sleep(20)
229 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
230 self.assertIn(b'Fetched metadata: no', stdout,
231 'Aktualizr should not have run yet' + stderr.decode() + stdout.decode())
232
233 stdout, stderr, retcode = self.qemu_command('aktualizr --running-mode=once')
234
235 stdout, stderr, retcode = self.qemu_command('aktualizr-info')
236 self.assertIn(b'Fetched metadata: yes', stdout,
237 'Aktualizr should have run' + stderr.decode() + stdout.decode())
238
196class RpiTests(OESelftestTestCase): 239class RpiTests(OESelftestTestCase):
197 240
198 def setUpLocal(self): 241 def setUpLocal(self):
@@ -554,7 +597,7 @@ class SecondaryTests(OESelftestTestCase):
554 597
555 def test_secondary_listening(self): 598 def test_secondary_listening(self):
556 print('Checking aktualizr-secondary service is listening') 599 print('Checking aktualizr-secondary service is listening')
557 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030') 600 stdout, stderr, retcode = self.qemu_command('aktualizr-check-discovery')
558 self.assertEqual(retcode, 0, "Unable to connect to secondary") 601 self.assertEqual(retcode, 0, "Unable to connect to secondary")
559 602
560 603