Skip to content

Commit

Permalink
test: Timeout when no plugin is available
Browse files Browse the repository at this point in the history
Instead of providing the default "denied" we keep the confirmation
request open.

Signed-off-by: Vyacheslav Yurkov <[email protected]>
  • Loading branch information
UVV-gh committed Mar 9, 2024
1 parent 655f937 commit e0df824
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest

from helper import run, run_pexpect, timezone_offset_utc
import subprocess

@pytest.fixture
def install_config(config, adjust_config):
Expand Down Expand Up @@ -150,20 +151,25 @@ def test_install_confirmation_denied(hawkbit, adjust_config, confirm_workflow_ha
assert f'Confirmation status code: {error_code}' in status[0]['messages']
assert denied_message in status[0]['messages']

def test_install_confirmation_denied_no_plugin(hawkbit, adjust_config, confirm_workflow_hawkbit, bundle_assigned):
def test_install_confirmation_no_plugin(hawkbit, adjust_config, confirm_workflow_hawkbit, bundle_assigned):
"""
Enable user confirmation in Hawkbit config.
Don't start confirmation plugin. This is equivalent to the rejection of installation.
Don't start confirmation plugin. The expected result should be a timeout,
we don't want to force any default on a user
"""
import re
config = adjust_config({'client':{'require_confirmation': 'true'}})
confirmed_regex = re.compile("Action .* denied")

out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r')
try:
out, err, exitcode = run(f'rauc-hawkbit-updater -c "{config}" -r', timeout=15)
assert False
except subprocess.TimeoutExpired as e:
# We expect timeout instead of "denied" response in case there's no plugin to handle the request
err = e.stderr
assert b'GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown' in err
assert True

status = hawkbit.get_action_status()
assert confirmed_regex.findall(out)
assert 'GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown' in err
# If the confirmation is rejected, the action continues to be in state WAITING_FOR_CONFIRMATION
# until it is confirmed at a later point in time or cancelled.
assert status[0]['type'] == 'wait_for_confirmation'
Expand Down

0 comments on commit e0df824

Please sign in to comment.