[Bug]: `TestLockOrder::test_lock_order[renew]` tries to make network connections
Maintainers usually reply within 1 day
@wgreenberg is already working on this.
Since Jun 26, 2025.
Assessment
This issue has not been assessed yet.
Description
OS
Fedora rawhide
Installation method
dnf
Certbot Version
4.1.1
What happened?
When trying to build certbot 4.1.1 in the Fedora build infrastructure, I get a test failure. It looks to me as if TestLockOrder::test_lock_order[renew] tries to make a network request. Our build infrastructure disables all network access.
Expected behavior
I would like to see mocking of network requests or a pytest marker so we can disable all tests accessing the network.
Relevant log output
=================================== FAILURES ===================================
_____________________ TestLockOrder.test_lock_order[renew] _____________________
self = <certbot._internal.tests.main_test.TestLockOrder object at 0x7f21a53a3230>
args_and_lock_order = (['-a', 'standalone', '-i', 'null', '--no-random-sleep-on-renew', '--config-dir', ...], ['/tmp/pytest-of-mockbuild/pyt...ytest-0/test_lock_order_renew_0/installer', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/authenticator'])
mock_lock_dir = <MagicMock name='lock_dir' id='139782473057008'>
def test_lock_order(self, args_and_lock_order, mock_lock_dir):
args, lock_order = args_and_lock_order
with pytest.raises(self.EXPECTED_ERROR_TYPE, match=self.EXPECTED_ERROR_STR_REGEX):
main.main(args)
> assert mock_lock_dir.call_count == len(lock_order)
E AssertionError: assert 3 == 5
E + where 3 = <MagicMock name='lock_dir' id='139782473057008'>.call_count
E + and 5 = len(['/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/logs', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/work', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/installer', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/authenticator'])
src/certbot/_internal/tests/main_test.py:2570: AssertionError
----------------------------- Captured stdout call -----------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing
/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/renewal/sample-renewal.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
----------------------------- Captured stderr call -----------------------------
Saving debug log to /tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/logs/letsencrypt.log
Failed to renew certificate sample-renewal with error: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
Failed to renew certificate sample-renewal with error: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
Failed to renew certificate sample-renewal with error: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
All renewals failed. The following certificates could not be renewed:
All renewals failed. The following certificates could not be renewed:
All renewals failed. The following certificates could not be renewed:
/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/live/sample-renewal/fullchain.pem (failure)
/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/live/sample-renewal/fullchain.pem (failure)
/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/live/sample-renewal/fullchain.pem (failure)
------------------------------ Captured log call -------------------------------
DEBUG certbot._internal.main:main.py:1852 certbot version: 4.1.1
DEBUG certbot._internal.main:main.py:1853 Location of certbot entry point: /usr/bin/pytest
DEBUG certbot._internal.main:main.py:1855 Arguments: ['renew', '-a', 'standalone', '-i', 'null', '--no-random-sleep-on-renew', '--config-dir', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config', '--logs-dir', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/logs', '--work-dir', '/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/work']
DEBUG certbot._internal.main:main.py:1856 Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#certbot-route53:auth,PluginEntryPoint#dns-cloudflare,PluginEntryPoint#dns-digitalocean,PluginEntryPoint#dns-dnsimple,PluginEntryPoint#dns-dnsmadeeasy,PluginEntryPoint#dns-gehirn,PluginEntryPoint#dns-google,PluginEntryPoint#dns-linode,PluginEntryPoint#dns-luadns,PluginEntryPoint#dns-nsone,PluginEntryPoint#dns-ovh,PluginEntryPoint#dns-rfc2136,PluginEntryPoint#dns-route53,PluginEntryPoint#dns-sakuracloud,PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
DEBUG certbot._internal.log:log.py:140 Root logging level set at 30
DEBUG certbot._internal.display.obj:obj.py:439 Notifying user: Processing
/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/renewal/sample-renewal.conf
DEBUG certbot.configuration:configuration.py:125 Var config_dir=/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config (set by user).
DEBUG certbot.configuration:configuration.py:125 Var logs_dir=/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/logs (set by user).
DEBUG certbot.configuration:configuration.py:125 Var work_dir=/tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/work (set by user).
DEBUG certbot._internal.plugins.selection:selection.py:342 Requested authenticator standalone and installer null
DEBUG certbot._internal.plugins.selection:selection.py:342 Requested authenticator standalone and installer null
DEBUG acme.client:client.py:743 Sending GET request to https://acme-staging-v02.api.letsencrypt.org/directory.
DEBUG urllib3.connectionpool:connectionpool.py:1049 Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org:443
ERROR certbot._internal.renewal:renewal.py:653 Failed to renew certificate sample-renewal with error: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
DEBUG certbot._internal.renewal:renewal.py:657 Traceback was:
Traceback (most recent call last):
File "/usr/lib/python3.14/site-packages/urllib3/connection.py", line 198, in _new_conn
sock = connection.create_connection(
(self._dns_host, self.port),
...<2 lines>...
socket_options=self.socket_options,
)
File "/usr/lib/python3.14/site-packages/urllib3/util/connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.14/socket.py", line 983, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Temporary failure in name resolution
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.14/site-packages/urllib3/connectionpool.py", line 787, in urlopen
response = self._make_request(
conn,
...<10 lines>...
**response_kw,
)
File "/usr/lib/python3.14/site-packages/urllib3/connectionpool.py", line 488, in _make_request
raise new_e
File "/usr/lib/python3.14/site-packages/urllib3/connectionpool.py", line 464, in _make_request
self._validate_conn(conn)
~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.14/site-packages/urllib3/connectionpool.py", line 1093, in _validate_conn
conn.connect()
~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/urllib3/connection.py", line 704, in connect
self.sock = sock = self._new_conn()
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.14/site-packages/urllib3/connection.py", line 205, in _new_conn
raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.14/site-packages/requests/adapters.py", line 668, in send
resp = conn.urlopen(
method=request.method,
...<9 lines>...
chunked=chunked,
)
File "/usr/lib/python3.14/site-packages/urllib3/connectionpool.py", line 841, in urlopen
retries = retries.increment(
method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
)
File "/usr/lib/python3.14/site-packages/urllib3/util/retry.py", line 519, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builddir/build/BUILD/certbot-4.1.1-build/certbot-4.1.1/certbot/src/certbot/_internal/renewal.py", line 624, in handle_renewal_request
if should_renew(lineage_config, renewal_candidate, acme_clients):
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/certbot-4.1.1-build/certbot-4.1.1/certbot/src/certbot/_internal/renewal.py", line 326, in should_renew
if should_autorenew(config, lineage, acme_clients):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/certbot-4.1.1-build/certbot-4.1.1/certbot/src/certbot/_internal/renewal.py", line 379, in should_autorenew
acme_clients[config.server] = client.acme_from_config_key(config)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/builddir/build/BUILD/certbot-4.1.1-build/certbot-4.1.1/certbot/src/certbot/_internal/client.py", line 73, in acme_from_config_key
directory = acme_client.ClientV2.get_directory(config.server, net)
File "/builddir/build/BUILD/certbot-4.1.1-build/BUILDROOT/usr/lib/python3.14/site-packages/acme/client.py", line 431, in get_directory
return messages.Directory.from_json(net.get(url).json())
~~~~~~~^^^^^
File "/builddir/build/BUILD/certbot-4.1.1-build/BUILDROOT/usr/lib/python3.14/site-packages/acme/client.py", line 807, in get
self._send_request('GET', url, **kwargs), content_type=content_type)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/certbot-4.1.1-build/BUILDROOT/usr/lib/python3.14/site-packages/acme/client.py", line 749, in _send_request
response = self.session.request(method, url, *args, **kwargs)
File "/usr/lib/python3.14/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.14/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3.14/site-packages/requests/adapters.py", line 701, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='acme-staging-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f21a481dbe0>: Failed to resolve 'acme-staging-v02.api.letsencrypt.org' ([Errno -3] Temporary failure in name resolution)"))
DEBUG certbot._internal.display.obj:obj.py:439 Notifying user:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ERROR certbot._internal.renewal:renewal.py:543 All renewals failed. The following certificates could not be renewed:
ERROR certbot._internal.renewal:renewal.py:545 /tmp/pytest-of-mockbuild/pytest-0/test_lock_order_renew_0/config/live/sample-renewal/fullchain.pem (failure)
DEBUG certbot._internal.display.obj:obj.py:439 Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
=========================== short test summary info ============================
FAILED src/certbot/_internal/tests/main_test.py::TestLockOrder::test_lock_order[renew]
- Dominant language
- Python
- Stars
- 33.4k
- Forks
- 3.5k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from certbot/certbot
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
dns-google: add_txt_record appends unquoted value onto quoted existing rrdatasPossibly taken @BeigeBox claimed this 229 days ago. Openhas pr
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Task]: Update apache configs to use ML-KEM handshakesPossibly taken @bmw claimed this 2 days ago. Open
certbot/certbot#10840 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
[Task]: Make 384 the default ECDSA curve sizePossibly taken @wgreenberg claimed this 2 days ago. Open
certbot/certbot#10838 · 1 comment · 4 reactions · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day