diff --git a/docs/get_started.md b/docs/get_started.md index dbe5eab43..2b0cdf98f 100644 --- a/docs/get_started.md +++ b/docs/get_started.md @@ -7,6 +7,7 @@ This page covers the following topics: - [Prerequisites](#prerequisites) - [Installation](#installation) - [Testing](#testing) +- [Additional Configuration Options](#additional-configuration-options) - [Troubleshooting](#troubleshooting) - [Review the report](#review-the-report) - [Uninstall](#uninstall) @@ -101,6 +102,70 @@ Note: For qualification purposes, you must select all. 12. Once the Waiting for Device notification appears, power on the device under test. A report appears under the Reports icon once the test sequence is complete. ![Reports button](/docs/ui/getstarted--m4si1otdu5d.png) +# Additional Configuration Options + +Some configuration options are available but not exposed through the user interface and requires direct access. +Modification of various configuration files is necessary to access these options. + +## Override test module timeout at the system level + +Testrun attempts to set reasonable timeouts for test modules to prevent overly long test times but sometimes +a device or series of device may require longer than these default values. These can be overridden at +the test module configuration level but is not preferred since these changes will be undone during every +version upgrade. To modify these values: + +1. Navigate to the testrun installation directory. By default, this will be at: + `/usr/local/testrun` + +2. Open the system.json file and add the following section: + `"test_modules":{}` + +3. Add the module name(s) and timeout property into this test_modules section you wish to +set the timeout property for: + ``` + "test_modules":{ + "connection":{ + "timeout": 500 + } + } + ``` + +Before timeout options: +``` +{ + "network": { + "device_intf": "ens0", + "internet_intf": "ens1" + }, + "log_level": "DEBUG", + "startup_timeout": 60, + "monitor_period": 60, + "max_device_reports": 5, + "org_name": "", + "single_intf": false + } +``` + +After timeout options: +``` +{ + "network": { + "device_intf": "ens0", + "internet_intf": "ens1" + }, + "log_level": "DEBUG", + "startup_timeout": 60, + "monitor_period": 60, + "max_device_reports": 5, + "org_name": "", + "single_intf": false, + "test_modules":{ + "connection":{ + "timeout": 500 + } + } +``` + # Troubleshooting If you encounter any issues, try the following: diff --git a/framework/python/src/core/docker/test_docker_module.py b/framework/python/src/core/docker/test_docker_module.py index 4bbf72594..13acd4857 100644 --- a/framework/python/src/core/docker/test_docker_module.py +++ b/framework/python/src/core/docker/test_docker_module.py @@ -39,11 +39,9 @@ def setup_module(self, module_json): # Set the defaults self.network = True self.total_tests = 0 - self.time = DEFAULT_TIMEOUT self.tests: list = [] - if 'timeout' in module_json['config']['docker']: - self.timeout = module_json['config']['docker']['timeout'] + self.timeout = self._get_module_timeout(module_json) # Determine if this module needs network access if 'network' in module_json['config']: @@ -133,3 +131,20 @@ def get_mounts(self): read_only=True) ] return mounts + + def _get_module_timeout(self, module_json): + timeout = DEFAULT_TIMEOUT + try: + timeout = DEFAULT_TIMEOUT + test_modules = self.get_session().get_config().get('test_modules', {}) + test_config = test_modules.get(self.name, {}) + sys_timeout = test_config.get('timeout', None) + + if sys_timeout is not None: + timeout = sys_timeout + elif 'timeout' in module_json['config']['docker']: + timeout = module_json['config']['docker']['timeout'] + except Exception: # pylint: disable=W0718 + # Ignore errors, just use default + timeout = DEFAULT_TIMEOUT + return timeout # pylint: disable=W0150 diff --git a/framework/python/src/core/session.py b/framework/python/src/core/session.py index 473933a1b..f2e5466d3 100644 --- a/framework/python/src/core/session.py +++ b/framework/python/src/core/session.py @@ -38,6 +38,7 @@ API_PORT_KEY = 'api_port' MAX_DEVICE_REPORTS_KEY = 'max_device_reports' ORG_NAME_KEY = 'org_name' +TEST_CONFIG_KEY = 'test_modules' CERTS_PATH = 'local/root_certs' CONFIG_FILE_PATH = 'local/system.json' STATUS_TOPIC = 'status' @@ -241,6 +242,11 @@ def _load_config(self): ORG_NAME_KEY ) + if TEST_CONFIG_KEY in config_file_json: + self._config[TEST_CONFIG_KEY] = config_file_json.get( + TEST_CONFIG_KEY + ) + def _load_version(self): version_cmd = util.run_command( 'dpkg-query --showformat=\'${Version}\' --show testrun')