Test multiple hostname lookup
This commit is contained in:
parent
aff11d7d84
commit
5b03540601
1 changed files with 10 additions and 0 deletions
|
@ -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):
|
||||||
|
|
Reference in a new issue