Skip to content

Commit b8b42de

Browse files
committed
Add set_kill_user_processes to disable KillUserProcesses to avoid test processes being terminated when the SSH session is reset
1 parent 547a563 commit b8b42de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lisa/operating_system.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ def add_azure_core_repo(
478478
) -> None:
479479
raise NotImplementedError("add_azure_core_repo is not implemented")
480480

481+
def set_kill_user_processes(self) -> None:
482+
raise NotImplementedError("set_kill_user_processes is not implemented")
483+
481484
def _process_extra_package_args(self, extra_args: Optional[List[str]]) -> str:
482485
if extra_args:
483486
add_args = " ".join(extra_args)
@@ -1867,6 +1870,8 @@ def __init__(self, node: Any) -> None:
18671870
self._dnf_tool_name: str
18681871

18691872
def _initialize_package_installation(self) -> None:
1873+
self.set_kill_user_processes()
1874+
18701875
result = self._node.execute("command -v dnf", no_info_log=True, shell=True)
18711876
if result.exit_code == 0:
18721877
self._dnf_tool_name = "dnf"
@@ -1897,6 +1902,17 @@ def add_azure_core_repo(
18971902
sudo=True,
18981903
)
18991904

1905+
# Disable KillUserProcesses to avoid test processes being terminated when
1906+
# the SSH session is reset
1907+
def set_kill_user_processes(self) -> None:
1908+
sed = self._node.tools[Sed]
1909+
sed.append(
1910+
text="KillUserProcesses=no",
1911+
file="/etc/systemd/logind.conf",
1912+
sudo=True,
1913+
)
1914+
self._node.tools[Service].restart_service("systemd-logind")
1915+
19001916

19011917
@dataclass
19021918
# `zypper lr` repolist is of the form

0 commit comments

Comments
 (0)