-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add mtls test for download and streaming installation
Based on the work of Florain Bezannier. Changes are that the client key and certificate are now provided to the rauc_dbus_dummy by rauc-hawkbit-updater through arguments of the InstallBundle method call (for streaming installations). This also removes the need for a separate mtls rauc_dbus_dummy fixture. Signed-off-by: Robin van der Gracht <[email protected]>
- Loading branch information
Showing
3 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
|
||
from helper import run | ||
|
||
@pytest.mark.parametrize('mode', ('download','streaming')) | ||
def test_install_success_mtls(hawkbit, adjust_config, bundle_assigned, | ||
mtls_download_port, mtls_config, | ||
rauc_dbus_install_success, mode): | ||
""" | ||
Assign bundle to target and test successful download and installation via MTLS. Make sure installation | ||
result is received correctly by hawkBit. | ||
""" | ||
config = adjust_config( | ||
{'client': { | ||
'hawkbit_server': f'localhost:{mtls_download_port}', | ||
"ssl": "true", | ||
"ssl_key": mtls_config.client_key, | ||
"ssl_cert": mtls_config.client_cert, | ||
"ssl_verify": "false", | ||
'stream_bundle': 'true' if mode == 'streaming' else "false"} | ||
}, | ||
remove={'client': ['bundle_download_location','auth_token']} if mode == 'streaming'else {'client':'auth_token'} | ||
) | ||
|
||
hawkbit.set_config("authentication.header.authority", mtls_config.get_issuer_hash()) | ||
hawkbit.set_config("authentication.header.enabled",True) | ||
|
||
out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r') | ||
|
||
assert 'New software ready for download' in out | ||
|
||
if mode == 'download': | ||
assert 'Download complete' in out | ||
|
||
assert 'Software bundle installed successfully.' in out | ||
assert err == '' | ||
assert exitcode == 0 | ||
|
||
status = hawkbit.get_action_status() | ||
assert status[0]['type'] == 'finished' |