Bläddra i källkod

Add test for host_node_name expansion

Mike Naberezny 14 år sedan
förälder
incheckning
988c90f8b2
1 ändrade filer med 14 tillägg och 0 borttagningar
  1. 14 0
      src/supervisor/tests/test_options.py

+ 14 - 0
src/supervisor/tests/test_options.py

@@ -627,6 +627,20 @@ class ServerOptionsTests(unittest.TestCase):
         self.assertEqual(pconfig.environment,
                          {'KEY1':'val1', 'KEY2':'val2', 'KEY3':'0'})
 
+    def test_processes_from_section_host_node_name_expansion(self):
+        instance = self._makeOne()
+        text = lstrip("""\
+        [program:foo]
+        command = /bin/foo --host=%(host_node_name)s
+        """)
+        from supervisor.options import UnhosedConfigParser
+        config = UnhosedConfigParser()
+        config.read_string(text)
+        pconfigs = instance.processes_from_section(config, 'program:foo', 'bar')
+        import platform
+        expected = "/bin/foo --host=" + platform.node()
+        self.assertEqual(pconfigs[0].command, expected)
+
     def test_processes_from_section_no_procnum_in_processname(self):
         instance = self._makeOne()
         text = lstrip("""\