diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oeqa/selftest/cases/updater.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 8686033..7ef834e 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py | |||
@@ -110,25 +110,25 @@ class AktualizrToolsTests(OESelftestTestCase): | |||
110 | 110 | ||
111 | def test_cert_provider_local_output(self): | 111 | def test_cert_provider_local_output(self): |
112 | logger = logging.getLogger("selftest") | 112 | logger = logging.getLogger("selftest") |
113 | logger.info('Running bitbake to build aktualizr-implicit-prov') | 113 | logger.info('Running bitbake to build aktualizr-ca-implicit-prov') |
114 | bitbake('aktualizr-implicit-prov') | 114 | bitbake('aktualizr-ca-implicit-prov') |
115 | bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS', 'T'], 'aktualizr-native') | 115 | bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS', 'T'], 'aktualizr-native') |
116 | creds = bb_vars['SOTA_PACKED_CREDENTIALS'] | 116 | creds = bb_vars['SOTA_PACKED_CREDENTIALS'] |
117 | temp_dir = bb_vars['T'] | 117 | temp_dir = bb_vars['T'] |
118 | bb_vars_prov = get_bb_vars(['STAGING_DIR_NATIVE', 'libdir'], 'aktualizr-implicit-prov') | 118 | bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') |
119 | config = bb_vars_prov['STAGING_DIR_NATIVE'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov.toml' | 119 | config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' |
120 | 120 | ||
121 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}' | 121 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}' |
122 | .format(creds=creds, temp=temp_dir, config=config)) | 122 | .format(creds=creds, temp=temp_dir, config=config)) |
123 | 123 | ||
124 | # Might be nice if these names weren't hardcoded. | 124 | # Might be nice if these names weren't hardcoded. |
125 | cert_path = temp_dir + '/client.pem' | 125 | cert_path = temp_dir + '/var/sota/import/client.pem' |
126 | self.assertTrue(os.path.isfile(cert_path), "Client certificate not found at %s." % cert_path) | 126 | self.assertTrue(os.path.isfile(cert_path), "Client certificate not found at %s." % cert_path) |
127 | self.assertTrue(os.path.getsize(cert_path) > 0, "Client certificate at %s is empty." % cert_path) | 127 | self.assertTrue(os.path.getsize(cert_path) > 0, "Client certificate at %s is empty." % cert_path) |
128 | pkey_path = temp_dir + '/pkey.pem' | 128 | pkey_path = temp_dir + '/var/sota/import/pkey.pem' |
129 | self.assertTrue(os.path.isfile(pkey_path), "Private key not found at %s." % pkey_path) | 129 | self.assertTrue(os.path.isfile(pkey_path), "Private key not found at %s." % pkey_path) |
130 | self.assertTrue(os.path.getsize(pkey_path) > 0, "Private key at %s is empty." % pkey_path) | 130 | self.assertTrue(os.path.getsize(pkey_path) > 0, "Private key at %s is empty." % pkey_path) |
131 | ca_path = temp_dir + '/root.crt' | 131 | ca_path = temp_dir + '/var/sota/import/root.crt' |
132 | self.assertTrue(os.path.isfile(ca_path), "Client certificate not found at %s." % ca_path) | 132 | self.assertTrue(os.path.isfile(ca_path), "Client certificate not found at %s." % ca_path) |
133 | self.assertTrue(os.path.getsize(ca_path) > 0, "Client certificate at %s is empty." % ca_path) | 133 | self.assertTrue(os.path.getsize(ca_path) > 0, "Client certificate at %s is empty." % ca_path) |
134 | 134 | ||
@@ -226,8 +226,8 @@ class ManualControlTests(OESelftestTestCase): | |||
226 | Disable the systemd service then run aktualizr manually | 226 | Disable the systemd service then run aktualizr manually |
227 | """ | 227 | """ |
228 | sleep(20) | 228 | sleep(20) |
229 | stdout, stderr, retcode = self.qemu_command('aktualizr-info --allow-migrate') | 229 | stdout, stderr, retcode = self.qemu_command('aktualizr-info') |
230 | self.assertIn(b'Fetched metadata: no', stdout, | 230 | self.assertIn(b'Can\'t open database', stdout, |
231 | 'Aktualizr should not have run yet' + stderr.decode() + stdout.decode()) | 231 | 'Aktualizr should not have run yet' + stderr.decode() + stdout.decode()) |
232 | 232 | ||
233 | stdout, stderr, retcode = self.qemu_command('aktualizr --running-mode=once') | 233 | stdout, stderr, retcode = self.qemu_command('aktualizr --running-mode=once') |
@@ -390,7 +390,9 @@ class ImplProvTests(OESelftestTestCase): | |||
390 | else: | 390 | else: |
391 | self.meta_qemu = None | 391 | self.meta_qemu = None |
392 | self.append_config('MACHINE = "qemux86-64"') | 392 | self.append_config('MACHINE = "qemux86-64"') |
393 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-implicit-prov "') | 393 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-ca-implicit-prov "') |
394 | self.append_config('SOTA_DEPLOY_CREDENTIALS = "0"') | ||
395 | runCmd('bitbake -c cleanall aktualizr aktualizr-ca-implicit-prov') | ||
394 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 396 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
395 | 397 | ||
396 | def tearDownLocal(self): | 398 | def tearDownLocal(self): |
@@ -435,10 +437,11 @@ class ImplProvTests(OESelftestTestCase): | |||
435 | # Run cert_provider. | 437 | # Run cert_provider. |
436 | bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') | 438 | bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') |
437 | creds = bb_vars['SOTA_PACKED_CREDENTIALS'] | 439 | creds = bb_vars['SOTA_PACKED_CREDENTIALS'] |
438 | bb_vars_prov = get_bb_vars(['STAGING_DIR_NATIVE', 'libdir'], 'aktualizr-implicit-prov') | 440 | bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') |
439 | config = bb_vars_prov['STAGING_DIR_NATIVE'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov.toml' | 441 | config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' |
440 | 442 | ||
441 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -g {config}' | 443 | print('Provisining at root@localhost:%d' % self.qemu.ssh_port) |
444 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}' | ||
442 | .format(creds=creds, port=self.qemu.ssh_port, config=config)) | 445 | .format(creds=creds, port=self.qemu.ssh_port, config=config)) |
443 | 446 | ||
444 | verifyProvisioned(self, machine) | 447 | verifyProvisioned(self, machine) |
@@ -461,7 +464,10 @@ class HsmTests(OESelftestTestCase): | |||
461 | self.meta_qemu = None | 464 | self.meta_qemu = None |
462 | self.append_config('MACHINE = "qemux86-64"') | 465 | self.append_config('MACHINE = "qemux86-64"') |
463 | self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"') | 466 | self.append_config('SOTA_CLIENT_PROV = "aktualizr-hsm-prov"') |
467 | self.append_config('SOTA_DEPLOY_CREDENTIALS = "0"') | ||
464 | self.append_config('SOTA_CLIENT_FEATURES = "hsm"') | 468 | self.append_config('SOTA_CLIENT_FEATURES = "hsm"') |
469 | self.append_config('IMAGE_INSTALL_append = " softhsm-testtoken"') | ||
470 | runCmd('bitbake -c cleanall aktualizr aktualizr-hsm-prov') | ||
465 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 471 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
466 | 472 | ||
467 | def tearDownLocal(self): | 473 | def tearDownLocal(self): |
@@ -519,7 +525,7 @@ class HsmTests(OESelftestTestCase): | |||
519 | bb_vars_prov = get_bb_vars(['STAGING_DIR_NATIVE', 'libdir'], 'aktualizr-hsm-prov') | 525 | bb_vars_prov = get_bb_vars(['STAGING_DIR_NATIVE', 'libdir'], 'aktualizr-hsm-prov') |
520 | config = bb_vars_prov['STAGING_DIR_NATIVE'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' | 526 | config = bb_vars_prov['STAGING_DIR_NATIVE'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' |
521 | 527 | ||
522 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -g {config}' | 528 | akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}' |
523 | .format(creds=creds, port=self.qemu.ssh_port, config=config)) | 529 | .format(creds=creds, port=self.qemu.ssh_port, config=config)) |
524 | 530 | ||
525 | # Verify that HSM is able to initialize. | 531 | # Verify that HSM is able to initialize. |