Skip to content

Commit

Permalink
Add failing test for %(host_node_name)s in include=
Browse files Browse the repository at this point in the history
Refs #737
  • Loading branch information
mnaberez committed Apr 11, 2016
1 parent 4987ae6 commit 3b3b90c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions supervisor/tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,35 @@ def test_read_config_include_extra_file_malformed(self):
finally:
shutil.rmtree(dirname, ignore_errors=True)

def test_read_config_include_expands_host_node_name(self):
dirname = tempfile.mkdtemp()
conf_d = os.path.join(dirname, "conf.d")
os.mkdir(conf_d)

supervisord_conf = os.path.join(dirname, "supervisord.conf")
text = lstrip("""\
[supervisord]
[include]
files=%s/conf.d/%s.conf
""" % (dirname, "%(host_node_name)s"))
with open(supervisord_conf, 'w') as f:
f.write(text)

conf_file = os.path.join(conf_d, "%s.conf" % platform.node())
with open(conf_file, 'w') as f:
f.write("[inet_http_server]\nport=8000\n")

instance = self._makeOne()
try:
instance.read_config(supervisord_conf)
finally:
shutil.rmtree(dirname, ignore_errors=True)
options = instance.configroot.supervisord
self.assertEqual(len(options.server_configs), 1)
msg = 'Included extra file "%s" during parsing' % conf_file
self.assertTrue(msg in instance.parse_infos)

def test_read_config_include_expands_here(self):
conf = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'fixtures',
Expand Down

0 comments on commit 3b3b90c

Please sign in to comment.