Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for successful/failing installations as well as failing installation due to no RAUC D-Bus interface available. Signed-off-by: Bastian Krause <bst@pengutronix.de>
- Loading branch information
1 parent
79c09b2
commit 483ed02
Showing
4 changed files
with
156 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ attrs | |
requests | ||
pydbus | ||
pygobject | ||
pexpect |
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,52 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-only | ||
# SPDX-FileCopyrightText: 2021 Bastian Krause <bst@pengutronix.de>, Pengutronix | ||
|
||
from helper import run | ||
|
||
def test_install_bundle_no_dbus_iface(hawkbit, bundle_assigned, config): | ||
"""Assign bundle to target and test installation without RAUC D-Bus interface available.""" | ||
out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r') | ||
|
||
err_lines = err.splitlines() | ||
|
||
assert 'New software ready for download' in out | ||
assert 'Download complete' in out | ||
assert err_lines.pop(0) == \ | ||
'WARNING: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name de.pengutronix.rauc was not provided by any .service files' | ||
assert err_lines.pop(0) == 'WARNING: Failed to install software bundle.' | ||
assert not err_lines | ||
assert exitcode == 1 | ||
|
||
status = hawkbit.get_action_status() | ||
assert status[0]['type'] == 'error' | ||
|
||
def test_install_success(hawkbit, config, bundle_assigned, rauc_dbus_install_success): | ||
""" | ||
Assign bundle to target and test successful download and installation. Make sure installation | ||
result is received correctly by hawkBit. | ||
""" | ||
out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r') | ||
|
||
assert 'New software ready for download' in out | ||
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' | ||
|
||
def test_install_failure(hawkbit, config, bundle_assigned, rauc_dbus_install_failure): | ||
""" | ||
Assign bundle to target and test successful download and failing installation. Make sure | ||
installation result is received correctly by hawkBit. | ||
""" | ||
out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r') | ||
|
||
assert 'New software ready for download' in out | ||
assert err.strip() == 'WARNING: Failed to install software bundle.' | ||
assert exitcode == 1 | ||
|
||
status = hawkbit.get_action_status() | ||
assert status[0]['type'] == 'error' | ||
assert 'Failed to install software bundle.' in status[0]['messages'] |