def ldap_ports(self) -> Optional[dict]: return { 'ldap_port': ContainerManager.get_container_port(self, "ldap", LDAP_PORT), 'ldap_ssl_port': ContainerManager.get_container_port(self, "ldap", LDAP_SSL_PORT) }
def test_get_container_port(self): self.container.ports = {"9999/tcp": [{"HostIp": "0.0.0.0", "HostPort": 1111}, ]} with self.subTest("Try to get port for non-existent container"): self.assertRaises(NotFound, ContainerManager.get_container_port, self.node, "c2", 9999) with self.subTest("No port"): self.assertIs(ContainerManager.get_container_port(self.node, "c1", 8888), None) with self.subTest("Open port"): self.assertEqual(ContainerManager.get_container_port(self.node, "c1", 9999), 1111) self.assertEqual(ContainerManager.get_container_port(self.node, "c1", "9999"), 1111)
def browser(self): ContainerManager.run_container(self.node, "web_driver") LOGGER.debug("Waiting for WebDriver container is up") ContainerManager.wait_for_status(self.node, "web_driver", "running") port = ContainerManager.get_container_port(self.node, "web_driver", WEB_DRIVER_REMOTE_PORT) LOGGER.debug("WebDriver port is %s", port) if self.use_tunnel: LOGGER.debug("Start auto_ssh for Selenium remote WebDriver") ContainerManager.run_container(self.node, "auto_ssh:web_driver", local_port=port, remote_port=get_free_port(), ssh_mode="-L") LOGGER.debug("Waiting for SSH tunnel container is up") ContainerManager.wait_for_status(self.node, "auto_ssh:web_driver", status="running") host = "127.0.0.1" port = int(ContainerManager.get_environ(self.node, "auto_ssh:web_driver")["SSH_TUNNEL_REMOTE"]) else: host = self.node.external_address LOGGER.debug("Waiting for port %s:%s is accepting connections", host, port) wait_for_port(host, port) time.sleep(WEB_DRIVER_CONTAINER_START_DELAY) return Remote(command_executor=f"http://{host}:{port}/wd/hub", options=ChromeOptions())
def syslogng_port(self) -> Optional[int]: return ContainerManager.get_container_port(self, "syslogng", SYSLOGNG_PORT)
def jepsen_results_port(self) -> Optional[int]: return ContainerManager.get_container_port(self, "jepsen", JEPSEN_RESULTS_PORT)
def rsyslog_port(self) -> Optional[int]: return ContainerManager.get_container_port(self, "rsyslog", RSYSLOG_PORT)