def test_get_container_ip(containers):
"""
Asserts that when an existing container is queried for its IP it returns
the specified projects and services IP address.
"""
actual_ip = Containers.get_container_ip_address(
project=containers.project,
service=ZOOKEEPER,
timeout_seconds=5
)
container_id = Containers.get_container_info(
project=containers.project,
service=ZOOKEEPER
)['Id']
command = "docker inspect --format '{{{{ .NetworkSettings.IPAddress }}}}' {container_id}" \
.format(container_id=container_id)
expected_ip = subprocess.check_output([command], shell=True)
assert expected_ip.rstrip() == actual_ip
评论列表
文章目录