Skip to content

Commit 292bb92

Browse files
committed
T7557: Prevent zombie process crashing pppoe smoketest
1 parent ec144c4 commit 292bb92

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

smoketest/scripts/cli/test_interfaces_pppoe.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import unittest
18+
import psutil
1819

19-
from psutil import process_iter
2020
from base_vyostest_shim import VyOSUnitTestSHIM
2121

2222
from vyos.configsession import ConfigSessionError
@@ -48,10 +48,13 @@ def tearDown(self):
4848
# Validate PPPoE client process
4949
for interface in self._interfaces:
5050
running = False
51-
for proc in process_iter():
52-
if interface in proc.cmdline():
53-
running = True
54-
break
51+
for proc in psutil.process_iter():
52+
try:
53+
if interface in proc.cmdline():
54+
running = True
55+
break
56+
except psutil.ZombieProcess:
57+
pass
5558
self.assertTrue(running)
5659

5760
self.cli_delete(base_path)
@@ -110,10 +113,13 @@ def test_pppoe_client_disabled_interface(self):
110113
# Validate PPPoE client process - must not run as interfaces are disabled
111114
for interface in self._interfaces:
112115
running = False
113-
for proc in process_iter():
114-
if interface in proc.cmdline():
115-
running = True
116-
break
116+
for proc in psutil.process_iter():
117+
try:
118+
if interface in proc.cmdline():
119+
running = True
120+
break
121+
except psutil.ZombieProcess:
122+
pass
117123
self.assertFalse(running)
118124

119125
# enable PPPoE interfaces

0 commit comments

Comments
 (0)