From 6d4285d7c47bbe5eb17dd02ff795514b6f746c7b Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Sun, 17 Jul 2022 13:24:05 +0200 Subject: [PATCH] pytest: add xfail test to show DNS w/o port issue This adds an X-Fail testcase that demonstrates that currently the port of a DNS announcement is not set to the corresponding network port (in this case regtest), but it will be set to 0. Changelog-None --- tests/test_gossip.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 2dacfb9db..466559e0a 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -239,7 +239,6 @@ def test_announce_and_connect_via_dns(node_factory, bitcoind): @unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911") -@pytest.mark.developer("gossip without DEVELOPER=1 is slow") def test_only_announce_one_dns(node_factory, bitcoind): # and test that we can't announce more than one DNS address l1 = node_factory.get_node(may_fail=True, expect_fail=True, @@ -247,6 +246,22 @@ def test_only_announce_one_dns(node_factory, bitcoind): wait_for(lambda: l1.daemon.is_in_stderr("Only one DNS can be announced")) +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911") +@pytest.mark.xfail(strict=True, raises=AssertionError) +def test_announce_dns_without_port(node_factory, bitcoind): + """ Checks that the port of a DNS announcement is set to the corresponding + network port. In this case regtest 19846 + """ + opts = {'announce-addr': ['example.com']} + l1 = node_factory.get_node(options=opts) + + # 'address': [{'type': 'dns', 'address': 'example.com', 'port': 0}] + info = l1.rpc.getinfo() + assert info['address'][0]['type'] == 'dns' + assert info['address'][0]['address'] == 'example.com' + assert info['address'][0]['port'] == 19846 + + @pytest.mark.developer("needs DEVELOPER=1") def test_gossip_timestamp_filter(node_factory, bitcoind, chainparams): # Updates get backdated 5 seconds with --dev-fast-gossip.