Skip to content

Commit

Permalink
host select: address dns setup on travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Mar 15, 2020
1 parent 980c9f1 commit 411cc83
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cylc/flow/tests/test_host_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
localhost_fqdn = get_fqdn_by_host(localhost)


# NOTE: ensure that all localhost aliases are actually alises of localhost,
# it would appear that this is not always the case
# on Travis-CI on of the alises has a different fqdn from the fqdn
# of the host it is an alias of
localhost_aliases = [
alias
for alias in localhost_aliases
if get_fqdn_by_host(alias) == localhost_fqdn
]


def test_hostname_checking():
"""Check that unknown hosts raise an error"""
with pytest.raises(socket.gaierror):
Expand All @@ -38,12 +49,11 @@ def test_localhost():

def test_unique():
"""Basic test choosing from multiple forms of localhost"""
assert select_host(
name, fqdn = select_host(
localhost_aliases + [localhost]
) == (
localhost,
localhost_fqdn
)
assert name in localhost_aliases + [localhost]
assert fqdn == localhost_fqdn


def test_filter():
Expand Down Expand Up @@ -153,6 +163,11 @@ def test_suite_host_select_default(mock_glbl_cfg):
assert host_fqdn == localhost_fqdn


# NOTE: on Travis-CI the fqdn of `localhost` is `localhost`
@pytest.mark.skipif(
localhost == localhost_fqdn,
reason='Cannot condemn a host unless is has a safe unique fqdn.'
)
def test_suite_host_select_condemned(mock_glbl_cfg):
"""Ensure condemned hosts are filtered out."""
mock_glbl_cfg(
Expand Down

0 comments on commit 411cc83

Please sign in to comment.