Skip to content

Testrun unresponsive and test pack related error thrown following upgrade to 2.3.4 #1561

Description

@duncangreene

Describe the bug
The below error is thrown when trying to view the UI following an upgrade to Testrun 2.3.4, where the existing Testrun install contains reports carried out in older versions of Testrun (seemingly < v2.0).

oss@oss-Inspiron-3542:~$ sudo testrun
[sudo] password for oss: 
Jun 29 10:22:07 session  DEBUG   Loading configuration file at /usr/local/testrun/local/system.json
Jun 29 10:22:07 session  DEBUG   Loading risk assessment format
Jun 29 10:22:07 session  DEBUG   Loading risk profiles
Jun 29 10:22:07 session  DEBUG   Discovered profile Smart Building.json
Jun 29 10:22:07 session  DEBUG   Loading certificates from local/root_certs
Jun 29 10:22:07 session  DEBUG   System timezone is Europe/London
Jun 29 10:22:07 testrun  DEBUG   Loading devices from local/devices
Jun 29 10:22:07 testrun  DEBUG   Loaded device EasyIO FW-14 with MAC address 38:d1:35:02:50:e8
Jun 29 10:22:07 testrun  DEBUG   Loaded device Lenovo ThinkPad with MAC address c8:a3:62:3d:11:e5
Jun 29 10:22:07 testrun  DEBUG   Loaded device Tridium JACE 8000 with MAC address 94:a9:a8:dc:94:3e
Jun 29 10:22:07 testrun  DEBUG   Loaded device EasyIO SystemView 7 with MAC address 1c:ca:e3:8f:4c:32
Jun 29 10:22:07 testrun  DEBUG   Loaded device iSMA iSMA-B-MIX18-IP with MAC address 00:1e:c0:fc:7d:d5
Jun 29 10:22:07 testrun  DEBUG   Loading test reports for device Axis M3057-PLR
Jun 29 10:22:07 testrun  INFO    No existing reports to copy
Jun 29 10:22:07 testrun  DEBUG   Loaded device Axis M3057-PLR with MAC address bb:bb:bb:bb:bb:bb
Jun 29 10:22:07 testrun  DEBUG   Loaded device Smart Tech SBID-6286S-V3 with MAC address 00:02:75:e2:25:c3
Jun 29 10:22:07 testrun  DEBUG   Loaded device Distech Controls ECY-450 with MAC address 90:06:f2:16:c4:b6
Jun 29 10:22:07 testrun  DEBUG   Loaded device Crestron DM-NVX-351 with MAC address c4:42:68:63:93:46
Jun 29 10:22:07 testrun  DEBUG   Loaded device Tridium JACE 9000 with MAC address 00:01:f0:96:aa:97
Jun 29 10:22:07 testrun  DEBUG   Loaded device Crestron UC-CX100-T with MAC address 90:8d:6e:95:90:4f
Jun 29 10:22:07 test_orc DEBUG   Starting test orchestrator
Jun 29 10:22:07 test_orc DEBUG   Loading test modules from /modules/test
Jun 29 10:22:07 test_orc INFO    Loaded the following test modules: protocol services conn tls dns ntp baseline 
Jun 29 10:22:07 testrun  INFO    Stopping websockets server
Jun 29 10:22:07 testrun  INFO    Starting WS server
Jun 29 10:22:11 testrun  INFO    Stopping user interface
Jun 29 10:22:11 testrun  INFO    Starting UI
Jun 29 10:22:13 testrun  INFO    User interface is ready on http://localhost:8080
Jun 29 10:22:13 api      INFO    Starting API
Jun 29 10:22:13 api      INFO    API waiting for requests
Jun 29 10:22:18 session  DEBUG   Network adapters change detected: {'adapters_added': {'enx3c18a0d57040': '3c:18:a0:d5:70:40', 'enp7s0': 'b8:2a:72:9b:9a:9b'}}
Jun 29 10:22:29 api      DEBUG   Received reports list request
Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 404, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 93, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 144, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/testrun/venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/testrun/framework/python/src/api/api.py", line 456, in get_reports
    "test_pack": report["device"]["test_pack"],
                 ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'test_pack'
Jun 29 10:22:32 api      DEBUG   Latest version available is 2.3.4
Jun 29 10:22:32 api      DEBUG   The latest version is installed

The error is caused by the missing test_pack (and maybe the missing device_profile keys for the report starting at line 3857 in this device_config.json. You'll see that this report was carried out in Testrun v1.4.

Manually adding in those keys and suitable values to the JSON remedies the error.

To Reproduce
Steps to reproduce the behavior:

  1. Have Testrun v1.4 install with pre-existing reports.
  2. Upgrade to v2.3.4.
  3. Load UI.

Expected behavior
Upgrade should carry out report upgrades cleanly.

Environment (please provide the following information about your setup):

  • Version 2.3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions