diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py index 1d4db3a2..4f5dbb55 100644 --- a/fail2ban/tests/filtertestcase.py +++ b/fail2ban/tests/filtertestcase.py @@ -1357,9 +1357,11 @@ class DNSUtilsNetworkTests(unittest.TestCase): res = DNSUtils.textToIp('www.example.com', 'no') self.assertEqual(res, []) res = DNSUtils.textToIp('www.example.com', 'warn') - self.assertEqual(res, ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) + # sort ipaddr, IPv4 is always smaller as IPv6 + self.assertEqual(sorted(res), ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) res = DNSUtils.textToIp('www.example.com', 'yes') - self.assertEqual(res, ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) + # sort ipaddr, IPv4 is always smaller as IPv6 + self.assertEqual(sorted(res), ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) def testTextToIp(self): # Test hostnames @@ -1371,7 +1373,8 @@ class DNSUtilsNetworkTests(unittest.TestCase): for s in hostnames: res = DNSUtils.textToIp(s, 'yes') if s == 'www.example.com': - self.assertEqual(res, ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) + # sort ipaddr, IPv4 is always smaller as IPv6 + self.assertEqual(sorted(res), ['93.184.216.34', '2606:2800:220:1:248:1893:25c8:1946']) else: self.assertEqual(res, [])