tests: Standardise on DockerizedSshDaemon.host & .port

This commit is contained in:
Alex Willmer 2024-10-10 15:23:49 +01:00
parent c45b13bee3
commit 9859e44ee8
2 changed files with 4 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class SshTest(testlib.DockerMixin, testlib.TestCase):
password='has_sudo_password', password='has_sudo_password',
) )
name = 'ssh.%s:%s' % ( name = 'ssh.%s:%s' % (
self.dockerized_ssh.get_host(), self.dockerized_ssh.host,
self.dockerized_ssh.port, self.dockerized_ssh.port,
) )
self.assertEqual(name, context.name) self.assertEqual(name, context.name)
@ -186,7 +186,7 @@ class BannerTest(testlib.DockerMixin, testlib.TestCase):
ssh_debug_level=3, ssh_debug_level=3,
) )
name = 'ssh.%s:%s' % ( name = 'ssh.%s:%s' % (
self.dockerized_ssh.get_host(), self.dockerized_ssh.host,
self.dockerized_ssh.port, self.dockerized_ssh.port,
) )
self.assertEqual(name, context.name) self.assertEqual(name, context.name)

View File

@ -574,14 +574,11 @@ class DockerizedSshDaemon(object):
self.image = image_template % d self.image = image_template % d
self.start_container() self.start_container()
self.host = self.get_host() self.host = get_docker_host()
self.port = self.get_port(self.container_name) self.port = self.get_port(self.container_name)
def get_host(self):
return get_docker_host()
def wait_for_sshd(self): def wait_for_sshd(self):
wait_for_port(self.get_host(), self.port, pattern='OpenSSH') wait_for_port(self.host, self.port, pattern='OpenSSH')
def check_processes(self): def check_processes(self):
# Get Accounting name (ucomm) & command line (args) of each process # Get Accounting name (ucomm) & command line (args) of each process