mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 18:04:31 +02:00
Rewrite lock_test.py (#9614)
`lock_test.py` is a weird, heavily customized, standalone testing relic that's giving me trouble because the name currently conflicts with `certbot/tests/lock_test.py`. Moving `certbot/tests` inside the Certbot package as discussed at https://github.com/certbot/certbot/issues/7909#issuecomment-1448675456 would avoid this, however, this is at least somewhat blocked on getting that test code passing lint and mypy checks again because we run those checks on the entirety of the Certbot package 🙃 Since `lock_test.py` could probably stand to be rewritten/refactored anyway, I took this approach. What I did is I rewrote something largely equivalent to `lock_test.py` inside Certbot's unit tests. I chose not to do this in `certbot-ci` because its not necessary to have an ACME server available. We're no longer explicitly testing things with the nginx plugin here like we were in `lock_test.py`, however, we are checking that `prepare` is called on the plugin at the right time and I added comments about the importance of checking that we lock the directory during the call to `prepare` in the Apache and nginx test code. As a bonus, this fixes https://github.com/certbot/certbot/issues/8121.
This commit is contained in:
@@ -63,6 +63,13 @@ class NginxConfiguratorTest(util.NginxTest):
|
||||
assert (1, 6, 2) == self.config.version
|
||||
|
||||
def test_prepare_locked(self):
|
||||
# It is important to test that server_root is locked during the call to
|
||||
# prepare (as opposed to somewhere else during plugin execution) to
|
||||
# ensure that this lock will be acquired after the Certbot package
|
||||
# acquires all of its locks. (Tests that Certbot calls prepare after
|
||||
# acquiring its locks are part of the Certbot package's tests.) Not
|
||||
# doing this could result in deadlock from two versions of Certbot that
|
||||
# acquire its locks in a different order.
|
||||
server_root = self.config.conf("server-root")
|
||||
|
||||
from certbot import util as certbot_util
|
||||
|
||||
Reference in New Issue
Block a user