Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix individual test disabling when run from the UI #629

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion framework/python/src/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,16 @@ async def start_test_run(self, request: Request, response: Response):
False, "Configured interfaces are not " +
"ready for use. Ensure required interfaces " + "are connected.")

device.test_modules = body_json["device"]["test_modules"]
# UI doesn't send individual test configs so we need to
# merge these manually until the UI is updated to handle
# the full config file
for module_name, module_config in device.test_modules.items():
# Check if the module exists in UI test modules
if module_name in body_json["device"]["test_modules"]:
# Merge the enabled state
module_config["enabled"] = body_json["device"]["test_modules"][module_name]["enabled"]

LOGGER.info(f'Device config{device.test_modules}')

LOGGER.info("Starting Testrun with device target " +
f"{device.manufacturer} {device.model} with " +
Expand Down
1 change: 0 additions & 1 deletion framework/python/src/net_orc/network_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ def network_adapters_checker(self, mgtt_client, topic):
"""Checks for changes in network adapters
and sends a message to the frontend
"""
LOGGER.debug('checking network adatpers...')
try:
adapters = self._session.detect_network_adapters_change()
if adapters:
Expand Down
5 changes: 5 additions & 0 deletions modules/test/base/python/src/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ def run_tests(self):
LOGGER.error(e)
else:
LOGGER.info(f'Test {test["name"]} not implemented. Skipping')
test['result'] = 'Error'
test['description'] = 'This test could not be found'
else:
LOGGER.debug(f'Test {test["name"]} is disabled')

# To be added in v1.3.2
# result = 'Disabled', 'This test is disabled and did not run'

if result is not None:
# Compliant or non-compliant as a boolean only
if isinstance(result, bool):
Expand Down
6 changes: 3 additions & 3 deletions modules/test/ntp/python/src/ntp_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ def _ntp_network_ntp_support(self):
result = False, 'Device has not sent any NTP requests'
elif device_sends_ntp3 and device_sends_ntp4:
result = False, ('Device sent NTPv3 and NTPv4 packets. ' +
'NTPv3 is not allowed.')
'NTPv3 is not allowed')
elif device_sends_ntp3:
result = False, ('Device sent NTPv3 packets. '
'NTPv3 is not allowed.')
'NTPv3 is not allowed')
elif device_sends_ntp4:
result = True, 'Device sent NTPv4 packets.'
result = True, 'Device sent NTPv4 packets'
LOGGER.info(result[1])
return result

Expand Down