@@ -363,6 +363,62 @@ def test_issue_1418_pidproxy_cmd_with_args(self):
363363 pidproxy .expect (pexpect .EOF )
364364 self .assertEqual (pidproxy .before .strip (), "1 2" )
365365
366+ def test_issue_1483a_identifier_default (self ):
367+ """When no identifier is supplied on the command line or in the config
368+ file, the default is used."""
369+ filename = pkg_resources .resource_filename (__name__ , 'fixtures/issue-1483a.conf' )
370+ args = ['-m' , 'supervisor.supervisord' , '-c' , filename ]
371+ supervisord = pexpect .spawn (sys .executable , args , encoding = 'utf-8' )
372+ self .addCleanup (supervisord .kill , signal .SIGINT )
373+ supervisord .expect_exact ('supervisord started with pid' )
374+
375+ from supervisor .compat import xmlrpclib
376+ from supervisor .xmlrpc import SupervisorTransport
377+ transport = SupervisorTransport ('' , '' , 'unix:///tmp/issue-1483a.sock' )
378+ try :
379+ server = xmlrpclib .ServerProxy ('http://transport.ignores.host/RPC2' , transport )
380+ ident = server .supervisor .getIdentification ()
381+ finally :
382+ transport .close ()
383+ self .assertEqual (ident , "supervisor" )
384+
385+ def test_issue_1483b_identifier_from_config_file (self ):
386+ """When the identifier is supplied in the config file only, that
387+ identifier is used instead of the default."""
388+ filename = pkg_resources .resource_filename (__name__ , 'fixtures/issue-1483b.conf' )
389+ args = ['-m' , 'supervisor.supervisord' , '-c' , filename ]
390+ supervisord = pexpect .spawn (sys .executable , args , encoding = 'utf-8' )
391+ self .addCleanup (supervisord .kill , signal .SIGINT )
392+ supervisord .expect_exact ('supervisord started with pid' )
393+
394+ from supervisor .compat import xmlrpclib
395+ from supervisor .xmlrpc import SupervisorTransport
396+ transport = SupervisorTransport ('' , '' , 'unix:///tmp/issue-1483b.sock' )
397+ try :
398+ server = xmlrpclib .ServerProxy ('http://transport.ignores.host/RPC2' , transport )
399+ ident = server .supervisor .getIdentification ()
400+ finally :
401+ transport .close ()
402+ self .assertEqual (ident , "from_config_file" )
403+
404+ def test_issue_1483c_identifier_from_command_line (self ):
405+ """When an identifier is supplied in both the config file and on the
406+ command line, the one from the command line is used."""
407+ filename = pkg_resources .resource_filename (__name__ , 'fixtures/issue-1483c.conf' )
408+ args = ['-m' , 'supervisor.supervisord' , '-c' , filename , '-i' , 'from_command_line' ]
409+ supervisord = pexpect .spawn (sys .executable , args , encoding = 'utf-8' )
410+ self .addCleanup (supervisord .kill , signal .SIGINT )
411+ supervisord .expect_exact ('supervisord started with pid' )
412+
413+ from supervisor .compat import xmlrpclib
414+ from supervisor .xmlrpc import SupervisorTransport
415+ transport = SupervisorTransport ('' , '' , 'unix:///tmp/issue-1483c.sock' )
416+ try :
417+ server = xmlrpclib .ServerProxy ('http://transport.ignores.host/RPC2' , transport )
418+ ident = server .supervisor .getIdentification ()
419+ finally :
420+ transport .close ()
421+ self .assertEqual (ident , "from_command_line" )
366422
367423def test_suite ():
368424 return unittest .findTestCases (sys .modules [__name__ ])
0 commit comments