Scope: GLOBAL
Device Library
Arguments: [image: str = debian-systemd, adapter: str = docker]
Initialize self. See help(type(self)) for accurate signature.
Arguments: [path: str]
Check if a directory is empty
- Args:
- path (str): Directory path
Arguments: [path: str]
Check if a directory exists
- Args:
- path (str): Directory path
Arguments: [path: str]
Check if a directory is empty
- Args:
- path (str): Directory path
Arguments: [path: str]
Check if a directory does not exists
- Args:
- path (str): Directory path
Arguments: [cmd: str, exp_exit_code: int = 0, log_output: bool = True]
Execute a device command
- Args:
- exp_exit_code (int, optional): Expected return code. Defaults to 0.
- Returns:
- str: _description_
Arguments: [path: str]
Check if a file exists
- Args:
- path (str): File path
Arguments: [path: str]
Check if a file does not exists
- Args:
- path (str): File path
Arguments: [name: str | None = None]
Get device log
- Args:
- name (str, optional): name. Defaults to current device.
- Raises:
- Exception: Unknown device
Arguments: [prefix: str = STC]
Get random name
- Args:
- prefix (str, optional): Name prefix. Defaults to "STC".
- Returns:
- str: Random name
Arguments: [*packages: str]
Install a list of packages via APT
You can specify specify to install the latest available, or use a specific version
- Args:
- *packages (str): packages to be installed. Version is optional, but when provided it should be in the format of 'mypackage=1.0.0'
- Returns:
- str: Command output
Arguments: [pattern: str]
Check if at least 1 process is running given a pattern
- Args:
- pattern (str): Process pattern (passed to pgrep -fa '<pattern>')
Arguments: [pattern: str]
Check that there are no processes matching a given pattern
- Args:
- pattern (str): Process pattern (passed to pgrep -fa '<pattern>')
Arguments: [*packages: str]
Purge a package (and its configuration) using APT
- Args:
- *packages (str): packages to be installed
- Returns:
- str: Command output
Arguments: [init_system: str = systemd]
Reload the services manager For systemd this would be a systemctl daemon-reload
Arguments: [*packages: str]
Remove a package via APT
- Returns:
- str: Command output
Arguments: [name: str, init_system: str = systemd]
Restart a service
- Args:
- path (str): File path
Arguments: [skip_bootstrap: bool = False]
Create a container device to use for testing
- Returns:
- str: Device serial number
Arguments: [pattern: str, minimum: int = 1, maximum: int | None = None]
Check how many processes are running which match a given pattern
- Args:
- pattern (str): Process pattern (passed to pgrep -fa '<pattern>') minimum (int, optional): Minimum number of matches. Defaults to 1. maximum (int, optional): Maximum number of matches. Defaults to None.
- Returns:
- int: Count of matching processes
Arguments: [name: str, init_system: str = systemd]
Start a service
- Args:
- path (str): File path
Arguments: []
Stop and cleanup the device
Arguments: [name: str, init_system: str = systemd]
Stop a service
- Args:
- path (str): File path
Arguments: [src: str, dst: str]
Transfer files to a device
- Args:
- src (str): Source file, folder or pattern dst (str): Destination path to copy to the files to
Arguments: []
Update APT package cache
- Returns:
- str: Command output
Arguments: []
Wait for the device to be ready