Test multiple hostname lookup

This commit is contained in:
Jake Howard 2018-12-12 23:19:05 +00:00
parent aff11d7d84
commit 5b03540601
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -20,6 +20,16 @@ class ProcessForHostnameTestCase(BaseTestCase):
self.assertIsNone(proc.poll()) self.assertIsNone(proc.poll())
self.assertEqual(utils.get_process_for_hostname("localhost").pid, proc.pid) self.assertEqual(utils.get_process_for_hostname("localhost").pid, proc.pid)
def test_finds_process_with_multiple_hostnames(self):
proc = subprocess.Popen(
"yes",
stdout=subprocess.PIPE,
env={**os.environ, utils.HOSTNAME_ENV_VAR: "localhost,test.local"},
)
self.assertIsNone(proc.poll())
self.assertEqual(utils.get_process_for_hostname("localhost").pid, proc.pid)
self.assertEqual(utils.get_process_for_hostname("test.local").pid, proc.pid)
class HostnameFromRequestTestCase(BaseTestCase): class HostnameFromRequestTestCase(BaseTestCase):
def get_request_for_hostname(self, hostname): def get_request_for_hostname(self, hostname):