Ensure main.bootstrap_from_dns() adds IPv6 addresses to the core nodes

This commit is contained in:
Lee Miller 2024-07-17 12:57:05 +03:00
parent d18dc793e3
commit 2f65ab2f63
Signed by: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -1,4 +1,5 @@
"""Tests for network connections""" """Tests for network connections"""
import ipaddress
import logging import logging
import os import os
import random import random
@ -78,6 +79,17 @@ class TestNetwork(unittest.TestCase):
main.bootstrap_from_dns() main.bootstrap_from_dns()
self.assertGreaterEqual(len(shared.core_nodes), core_nodes_len) self.assertGreaterEqual(len(shared.core_nodes), core_nodes_len)
for host, _ in shared.core_nodes:
try:
ipaddress.IPv4Address(host)
except ipaddress.AddressValueError:
try:
ipaddress.IPv6Address(host)
except ipaddress.AddressValueError:
self.fail('Found not an IP address in the core nodes')
break
else:
self.fail('No IPv6 address found in the core nodes')
def test_bootstrap(self): def test_bootstrap(self):
"""Start bootstrappers and check node pool""" """Start bootstrappers and check node pool"""