tbot_contrib.utils
¶
Various testcases.
-
tbot_contrib.utils.
ensure_sd_unit
(lnx: tbot.machine.linux.linux_shell.LinuxShell, services: List[str]) → None[source]¶ check if all systemd services in list services run on linux machine lnx. If not, try to start them.
- Parameters
lnx – linux shell
services – list of systemd services
-
tbot_contrib.utils.
find_ip_address
(lnx: tbot.machine.linux.linux_shell.LinuxShell, route_target: Optional[str] = None, force: bool = False) → str[source]¶ Find out an IP-address of a host.
In times where most hosts have many IP addresses, this is not as trivial as one would like. This testcase approaches the problem by trying to find the IP-address, the host would use on a certain route.
By default, this is the route to reach a theoretical host at
1.0.0.0
. This will yield a sensible result in most cases but of course will not always be the address you want. For more fine-grained control you can pass aroute_target
. This is the IP-address of this theoretical host to reach.- Parameters
lnx (linux.LinuxShell) – The host to work on.
route_target (str) – An optional route target. Defaults to
1.0.0.0
.force (bool) – By default, this testcase caches results for faster lookup when called multiple times. This parameter enforces a re-check which might be useful when the network configuration on
lnx
changed.
- Return type
- Returns
The IP-address which was found.