From b7714db4f603781806ef1d1341d755327250a043 Mon Sep 17 00:00:00 2001 From: mnbogner Date: Wed, 11 Mar 2026 19:41:51 -0700 Subject: [PATCH 1/2] added check foripv6 suppot to dns tests --- tests/shared_test_code.py | 13 +++++++++++++ tests/test_index.py | 4 +++- tests/test_integration.py | 7 ++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/shared_test_code.py b/tests/shared_test_code.py index adb7763c..6eaf44db 100644 --- a/tests/shared_test_code.py +++ b/tests/shared_test_code.py @@ -16,6 +16,7 @@ # along with this program. If not, see . import os +import socket import sys import tempfile import unittest @@ -91,3 +92,15 @@ def mock_urlopen(status=200, body=None): resp.read.return_value = body resp.__enter__.return_value = resp return unittest.mock.Mock(return_value=resp) + + +def supports_ipv6(): + if not socket.has_ipv6: + return False + try: + for result in socket.getaddrinfo('f-droid.org', 443): + if result[0] == socket.AF_INET6: + return True + except Exception as e: + print('Failed to get DNS results for test URL: ' + str(e)) + return False diff --git a/tests/test_index.py b/tests/test_index.py index c9a01305..30c330d3 100755 --- a/tests/test_index.py +++ b/tests/test_index.py @@ -17,7 +17,7 @@ import yaml import fdroidserver from fdroidserver import common, index, publish, signindex, update -from .shared_test_code import GP_FINGERPRINT, TmpCwd, mkdtemp +from .shared_test_code import GP_FINGERPRINT, TmpCwd, mkdtemp, supports_ipv6 basedir = Path(__file__).parent @@ -1200,6 +1200,7 @@ class DnsCacheTest(SetUpTearDownMixin, unittest.TestCase): common.config = {'include_dns_lookups': True} self.assertTrue(index.get_dnsa_results(self.url)) + @unittest.skipUnless(supports_ipv6(), "Test requires working IPv6 to run") def test_f_droid_org_aaaa(self): common.config = {'include_dns_lookups': True} self.assertTrue(index.get_dnsaaaa_results(self.url)) @@ -1209,6 +1210,7 @@ class DnsCacheTest(SetUpTearDownMixin, unittest.TestCase): a = index.get_dnsa_results(self.url) self.assertEqual(a, sorted(set(a))) + @unittest.skipUnless(supports_ipv6(), "Test requires working IPv6 to run") def test_no_AAAA_duplicates(self): common.config = {'include_dns_lookups': True} aaaa = index.get_dnsaaaa_results(self.url) diff --git a/tests/test_integration.py b/tests/test_integration.py index 64e6db35..d07d5b0c 100755 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -21,7 +21,7 @@ except ModuleNotFoundError: from fdroidserver._yaml import yaml, yaml_dumper -from .shared_test_code import mkdir_testfiles, VerboseFalseOptions +from .shared_test_code import mkdir_testfiles, supports_ipv6, VerboseFalseOptions # TODO: port generic tests that use index.xml to index-v2 (test that # explicitly test index-v0 should still use index.xml) @@ -1723,6 +1723,7 @@ class IntegrationTest(unittest.TestCase): with open('repo/index-v2.json') as fp: data = json.load(fp) self.assertIsNotNone(data['repo'].get('dnsA')) - self.assertIsNotNone(data['repo'].get('dnsAAAA')) self.assertIsNotNone(data['repo']['mirrors'][0].get('dnsA')) - self.assertIsNotNone(data['repo']['mirrors'][0].get('dnsAAAA')) + if supports_ipv6(): + self.assertIsNotNone(data['repo'].get('dnsAAAA')) + self.assertIsNotNone(data['repo']['mirrors'][0].get('dnsAAAA')) From 2e4b8c8d150988770645833bbd7810118214382a Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 12 Mar 2026 21:36:22 +0100 Subject: [PATCH 2/2] fix Fedora check in macOS job platform.freedesktop_os_release() requires that /etc/os-release or /usr/lib/os-release is present. --- tests/test_integration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_integration.py b/tests/test_integration.py index d07d5b0c..512e17e5 100755 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -250,6 +250,7 @@ class IntegrationTest(unittest.TestCase): @unittest.skipUnless( ( (shutil.which("gpg-agent") is not None) + and platform.system() == 'Linux' and (platform.freedesktop_os_release()['ID'] != 'fedora') ), "requires Debian compatible gpg-agent built for gpg",