Skip to content

Commit

Permalink
Add set_kill_user_processes to disable KillUserProcesses to avoid tes…
Browse files Browse the repository at this point in the history
…t processes being terminated when the SSH session is reset
  • Loading branch information
LiliDeng committed Jul 15, 2024
1 parent 547a563 commit b8b42de
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lisa/operating_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ def add_azure_core_repo(
) -> None:
raise NotImplementedError("add_azure_core_repo is not implemented")

def set_kill_user_processes(self) -> None:
raise NotImplementedError("set_kill_user_processes is not implemented")

def _process_extra_package_args(self, extra_args: Optional[List[str]]) -> str:
if extra_args:
add_args = " ".join(extra_args)
Expand Down Expand Up @@ -1867,6 +1870,8 @@ def __init__(self, node: Any) -> None:
self._dnf_tool_name: str

def _initialize_package_installation(self) -> None:
self.set_kill_user_processes()

result = self._node.execute("command -v dnf", no_info_log=True, shell=True)
if result.exit_code == 0:
self._dnf_tool_name = "dnf"
Expand Down Expand Up @@ -1897,6 +1902,17 @@ def add_azure_core_repo(
sudo=True,
)

# Disable KillUserProcesses to avoid test processes being terminated when
# the SSH session is reset
def set_kill_user_processes(self) -> None:
sed = self._node.tools[Sed]
sed.append(
text="KillUserProcesses=no",
file="/etc/systemd/logind.conf",
sudo=True,
)
self._node.tools[Service].restart_service("systemd-logind")


@dataclass
# `zypper lr` repolist is of the form
Expand Down

0 comments on commit b8b42de

Please sign in to comment.