test_respawn.py (1730:44912af5b3e6) test_respawn.py (1736:22db875fda34)
1import re
2import subprocess
3import time
4
1import re
2import subprocess
3import time
4
5from conftest import skip_alert
6from unit.applications.lang.python import TestApplicationPython
7from unit.option import option
8
9
10class TestRespawn(TestApplicationPython):
11 prerequisites = {'modules': {'python': 'any'}}
12
13 PATTERN_ROUTER = 'unit: router'

--- 37 unchanged lines hidden (view full) ---

51 # Check if the only one router, controller,
52 # and application processes running.
53
54 output = subprocess.check_output(['ps', 'ax']).decode()
55 assert len(re.findall(self.PATTERN_ROUTER, output)) == 1
56 assert len(re.findall(self.PATTERN_CONTROLLER, output)) == 1
57 assert len(re.findall(self.app_name, output)) == 1
58
5from unit.applications.lang.python import TestApplicationPython
6from unit.option import option
7
8
9class TestRespawn(TestApplicationPython):
10 prerequisites = {'modules': {'python': 'any'}}
11
12 PATTERN_ROUTER = 'unit: router'

--- 37 unchanged lines hidden (view full) ---

50 # Check if the only one router, controller,
51 # and application processes running.
52
53 output = subprocess.check_output(['ps', 'ax']).decode()
54 assert len(re.findall(self.PATTERN_ROUTER, output)) == 1
55 assert len(re.findall(self.PATTERN_CONTROLLER, output)) == 1
56 assert len(re.findall(self.app_name, output)) == 1
57
59 def test_respawn_router(self):
58 def test_respawn_router(self, skip_alert):
60 pid = self.pid_by_name(self.PATTERN_ROUTER)
61
62 self.kill_pids(pid)
63 skip_alert(r'process %s exited on signal 9' % pid)
64
65 assert self.wait_for_process(self.PATTERN_ROUTER) is not None
66
67 self.smoke_test()
68
59 pid = self.pid_by_name(self.PATTERN_ROUTER)
60
61 self.kill_pids(pid)
62 skip_alert(r'process %s exited on signal 9' % pid)
63
64 assert self.wait_for_process(self.PATTERN_ROUTER) is not None
65
66 self.smoke_test()
67
69 def test_respawn_controller(self):
68 def test_respawn_controller(self, skip_alert):
70 pid = self.pid_by_name(self.PATTERN_CONTROLLER)
71
72 self.kill_pids(pid)
73 skip_alert(r'process %s exited on signal 9' % pid)
74
75 assert self.wait_for_process(self.PATTERN_CONTROLLER) is not None
76
77 assert self.get()['status'] == 200
78
79 self.smoke_test()
80
69 pid = self.pid_by_name(self.PATTERN_CONTROLLER)
70
71 self.kill_pids(pid)
72 skip_alert(r'process %s exited on signal 9' % pid)
73
74 assert self.wait_for_process(self.PATTERN_CONTROLLER) is not None
75
76 assert self.get()['status'] == 200
77
78 self.smoke_test()
79
81 def test_respawn_application(self):
80 def test_respawn_application(self, skip_alert):
82 pid = self.pid_by_name(self.app_name)
83
84 self.kill_pids(pid)
85 skip_alert(r'process %s exited on signal 9' % pid)
86
87 assert self.wait_for_process(self.app_name) is not None
88
89 self.smoke_test()
81 pid = self.pid_by_name(self.app_name)
82
83 self.kill_pids(pid)
84 skip_alert(r'process %s exited on signal 9' % pid)
85
86 assert self.wait_for_process(self.app_name) is not None
87
88 self.smoke_test()