Skip to content

Commit c32cf22

Browse files
committed
Add test for Supervisor#986
1 parent f1e3ed3 commit c32cf22

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[supervisord]
2+
loglevel=debug ; log level; default info; others: debug,warn,trace
3+
logfile=/tmp/issue-986.log ; main log file; default $CWD/supervisord.log
4+
pidfile=/tmp/issue-986.pid ; supervisord pidfile; default supervisord.pid
5+
nodaemon=true ; start in foreground if true; default false
6+
7+
[rpcinterface:supervisor]
8+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
9+
10+
[unix_http_server]
11+
file=/tmp/issue-986.sock ; the path to the socket file
12+
13+
[supervisorctl]
14+
serverurl=unix:///tmp/issue-986.sock ; use a unix:// URL for a unix socket
15+
16+
[program:echo]
17+
command=bash -c "echo 'dhcrelay -d -q -a %%h:%%p %%P -i Vlan1000 192.168.0.1'"
18+
startsecs=0
19+
autorestart=false

supervisor/tests/test_end_to_end.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ def test_issue_836(self):
151151
seen = False
152152
self.assertTrue(seen)
153153

154+
def test_issue_986_command_string_with_double_percent(self):
155+
"""A percent sign can be used in a command= string without being
156+
expanded if it is escaped by a second percent sign."""
157+
filename = pkg_resources.resource_filename(__name__, 'fixtures/issue-986.conf')
158+
args = ['-m', 'supervisor.supervisord', '-c', filename]
159+
supervisord = pexpect.spawn(sys.executable, args, encoding='utf-8')
160+
self.addCleanup(supervisord.kill, signal.SIGINT)
161+
supervisord.expect_exact('dhcrelay -d -q -a %h:%p %P -i Vlan1000 192.168.0.1')
162+
154163
def test_issue_1054(self):
155164
"""When run on Python 3, the 'supervisorctl avail' command
156165
should work."""
@@ -320,7 +329,7 @@ def test_issue_1298(self):
320329
self.addCleanup(bash.kill, signal.SIGINT)
321330
bash.expect('spewage 2', timeout=30)
322331

323-
def test_issue_1481_pidproxy_cmd_with_no_args(self):
332+
def test_issue_1418_pidproxy_cmd_with_no_args(self):
324333
"""When pidproxy is given a command to run that has no arguments, it
325334
runs that command."""
326335
args = ['-m', 'supervisor.pidproxy', 'nonexistent-pidfile', "/bin/echo"]
@@ -329,7 +338,7 @@ def test_issue_1481_pidproxy_cmd_with_no_args(self):
329338
pidproxy.expect(pexpect.EOF)
330339
self.assertEqual(pidproxy.before.strip(), "")
331340

332-
def test_issue_1481_pidproxy_cmd_with_args(self):
341+
def test_issue_1418_pidproxy_cmd_with_args(self):
333342
"""When pidproxy is given a command to run that has arguments, it
334343
runs that command."""
335344
args = ['-m', 'supervisor.pidproxy', 'nonexistent-pidfile', "/bin/echo", "1", "2"]
@@ -338,6 +347,7 @@ def test_issue_1481_pidproxy_cmd_with_args(self):
338347
pidproxy.expect(pexpect.EOF)
339348
self.assertEqual(pidproxy.before.strip(), "1 2")
340349

350+
341351
def test_suite():
342352
return unittest.findTestCases(sys.modules[__name__])
343353

0 commit comments

Comments
 (0)