diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oeqa/selftest/cases/testutils.py | 19 | ||||
-rw-r--r-- | lib/oeqa/selftest/cases/updater_qemux86_64.py | 6 |
2 files changed, 18 insertions, 7 deletions
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 8d618a6..802d665 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py | |||
@@ -119,20 +119,29 @@ def verifyNotProvisioned(testInst, machine): | |||
119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) | 119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) |
120 | 120 | ||
121 | 121 | ||
122 | def verifyProvisioned(testInst, machine): | 122 | def verifyProvisioned(testInst, machine, hwid=''): |
123 | # Verify that device HAS provisioned. | 123 | # Verify that device HAS provisioned. |
124 | # First loop while waiting for the device to boot. | ||
124 | ran_ok = False | 125 | ran_ok = False |
125 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: | 126 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: |
126 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') | 127 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') |
127 | if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0: | 128 | if retcode == 0 and stderr == b'': |
128 | ran_ok = True | 129 | ran_ok = True |
129 | break | 130 | break |
130 | sleep(delay) | 131 | sleep(delay) |
131 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | 132 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) |
132 | 133 | # Then wait for aktualizr to provision. | |
134 | if stdout.decode().find('Fetched metadata: yes') < 0: | ||
135 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') | ||
136 | testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
137 | testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
133 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 138 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
134 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, | 139 | if hwid == '': |
135 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 140 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, |
141 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
142 | else: | ||
143 | testInst.assertIn(b'Primary ecu hardware ID: ' + hwid.encode(), stdout, | ||
144 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
136 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 145 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
137 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') | 146 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') |
138 | m = p.search(stdout.decode()) | 147 | m = p.search(stdout.decode()) |
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py index 2b4726c..24abcff 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py | |||
@@ -85,6 +85,7 @@ class SharedCredProvTests(OESelftestTestCase): | |||
85 | self.append_config('MACHINE = "qemux86-64"') | 85 | self.append_config('MACHINE = "qemux86-64"') |
86 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | 86 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') |
87 | self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') | 87 | self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') |
88 | self.append_config('SOTA_HARDWARE_ID = "plain_reibekuchen_314"') | ||
88 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 89 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
89 | 90 | ||
90 | def tearDownLocal(self): | 91 | def tearDownLocal(self): |
@@ -107,7 +108,8 @@ class SharedCredProvTests(OESelftestTestCase): | |||
107 | self.assertEqual(value, machine, | 108 | self.assertEqual(value, machine, |
108 | 'MACHINE does not match hostname: ' + machine + ', ' + value) | 109 | 'MACHINE does not match hostname: ' + machine + ', ' + value) |
109 | 110 | ||
110 | verifyProvisioned(self, machine) | 111 | hwid = get_bb_var('SOTA_HARDWARE_ID') |
112 | verifyProvisioned(self, machine, hwid) | ||
111 | 113 | ||
112 | 114 | ||
113 | class ManualControlTests(OESelftestTestCase): | 115 | class ManualControlTests(OESelftestTestCase): |
@@ -358,7 +360,7 @@ class IpSecondaryTests(OESelftestTestCase): | |||
358 | self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | 360 | self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') |
359 | 361 | ||
360 | def is_ecu_registered(self, ecu_id): | 362 | def is_ecu_registered(self, ecu_id): |
361 | max_number_of_tries = 40 | 363 | max_number_of_tries = 120 |
362 | try_counter = 0 | 364 | try_counter = 0 |
363 | 365 | ||
364 | # aktualizr-info is not always able to load ECU serials from DB | 366 | # aktualizr-info is not always able to load ECU serials from DB |