Skip to content

setup_timeout and test_timeout config values read as strings, causing TypeError in aexpect #6276

@niliayu

Description

@niliayu

Describe the bug
RemoteSpawnerInit.initialize() registers the setup_timeout and test_timeout config options without specifying key_type=int. Since Settings.register_option() defaults to key_type=str, values provided via a config file are parsed as strings rather than integers. When these string values are passed to aexpect's session.cmd_status_output(command, timeout), aexpect internally performs time.time() + timeout, which raises TypeError: unsupported operand type(s) for +: 'float' and 'str'.
The bug only manifests when the timeouts are explicitly set in a config file. The Python int defaults (3600 and 14400) work correctly because they bypass config-file string parsing.

Steps to reproduce

  1. Create a remote spawner config file (remote.conf):
   [spawner.remote]
   slots = ['slots/my-host.json']
   setup_timeout = 30
   test_timeout = 900
  1. Configure a valid remote slot JSON file at slots/my-host.json with SSH credentials.
  2. Create a setup_hook script (or any test that triggers the setup hook path), or simply run a test long enough for the test_timeout to be used.
  3. Run:
   avocado --config remote.conf run --spawner=remote my_test.py

Expected behavior
The timeout values 30 and 900 are parsed as integers and passed to aexpect's session.cmd_status_output(command, timeout). The remote command executes with the specified timeouts.

Current behavior
The values are read as strings ("30", "900") from the config file. When aexpect attempts time.time() + "30", it raises:

TypeError: unsupported operand type(s) for +: 'float' and 'str'

System information (please complete the following information):

  • OS:
ProductName:            macOS
ProductVersion:         15.7.4
BuildVersion:           24G517
  • Avocado version: 113.0 (latest main at commit 5febd60)
  • Avocado installation method: uv

Additional information
I locally patched this by adding key_type=int to both register_option calls in optional_plugins/spawner_remote/avocado_spawner_remote/__init__.py.
I don't see if there are currently any unit or functional tests for RemoteSpawner, and the settings unit tests (selftests/unit/settings.py) test key_type for bool, str, and list but not int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Short Term (Current Q) Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions