Review: Needs Fixing
Diff comments:
> diff --git a/systemtests/chaos.py b/systemtests/chaos.py
> new file mode 100644
> index 0000000..e36187a
> --- /dev/null
> +++ b/systemtests/chaos.py
> @@ -0,0 +1,21 @@
> +import random
> +from typing import List
> +
> +from .ansible import AnsibleHost
> +from .lxd import CLILXD
> +
> +
> +class ChaosMixin:
> + def down_a_host(self, lxd: CLILXD, hostname: str) -> None:
> + lxd.stop_instance(hostname)
this should just take an Instance which already has a `.stop(force:bool =
False)` that would be handy here
> +
> + def down_random_host(self, lxd: CLILXD, hostnames: List[str]) -> None:
> + target_host = random.choice(hostnames)
> + self.down_a_host(lxd, target_host)
> +
> + def down_postgres_primary(
> + self, lxd: CLILXD, ansible_hosts: List[AnsibleHost]
> + ) -> None:
> + for host in ansible_hosts:
> + if host.is_postgres_primary:
> + self.down_a_host(lxd, host.name)
s/host.name/host.instance/
> diff --git a/systemtests/lxd.py b/systemtests/lxd.py
> index 8ea9121..1ef25a6 100644
> --- a/systemtests/lxd.py
> +++ b/systemtests/lxd.py
> @@ -450,6 +451,9 @@ class CLILXD:
> instances = {instance["name"]: instance for instance in lxc_list}
> return instances
>
> + def stop_instance(self, name: str) -> None:
KIWF
> + self._run(["lxc", "stop", name])
> +
> def create_vm(self, instance_name: str, config: dict[str, str]) ->
> Instance:
> logger = self.logger.getChild(instance_name)
> args: list[str] = []
--
https://code.launchpad.net/~cgrabowski/maas-ci/+git/system-tests/+merge/438502
Your team MAAS Committers is subscribed to branch
~maas-committers/maas-ci/+git/system-tests:master.
--
Mailing list: https://launchpad.net/~sts-sponsors
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help : https://help.launchpad.net/ListHelp