-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to fix flaky GPG test by stopping gpg-agent #104
Open
krobelus
wants to merge
2
commits into
mystor:main
Choose a base branch
from
krobelus:try-fix-gpg-agent-cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rwe
reviewed
Oct 4, 2021
tests/conftest.py
Outdated
try: | ||
yield | ||
finally: | ||
bash("gpgconf --kill gpg-agent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just --kill all
? Not sure if dirmngr
or scdaemon
might also be used
The new GPG tests fail occasionally, for example in https://github.com/mystor/git-revise/pull/99/checks?check_run_id=3785380820 An excerpt from the job log is added below. I'm not sure if problem is the FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' or the gpg failed to sign commit line; neither should happen. The first sounds like a race between the GPG agent shutdown and the cleanup of the test's temp dir. Try to fix that by stopping the agent before cleanup. Intuitively, this fix makes sense because it's probably not normal to remove $GNUPGHOME while gpg-agent is running. Extract everything that handles our temporary $GNUPGHOME to a fixture, so we can include a cleanup step. This could be tested by repeating this in the CI a number of times but I'm not sure if that's worth it. Unfortunately, the "gpg failed to sign commit" (very last line of the log below) does not tell us which one failed but that probably wouldn't help either. ============================= test session starts ============================== tests/test_gpgsign.py .E ==================================== ERRORS ==================================== ______________________ ERROR at teardown of test_gpgsign _______________________ @pytest.fixture def short_tmpdir(): with tempfile.TemporaryDirectory() as tdir: > yield py.path.local(tdir) tests/conftest.py:67: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/tempfile.py:809: in __exit__ self.cleanup() /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/tempfile.py:813: in cleanup _shutil.rmtree(self.name) /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:486: in rmtree _rmtree_safe_fd(fd, path, onerror) /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:444: in _rmtree_safe_fd onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ topfd = 11, path = '/tmp/tmpdqw8v4oq' onerror = <function rmtree.<locals>.onerror at 0x7fe22474da60> def _rmtree_safe_fd(topfd, path, onerror): ... try: > os.unlink(name, dir_fd=topfd) E FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra' /opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/shutil.py:442: FileNotFoundError ----------------------------- Captured stdout call ----------------------------- [master (root-commit) 5aa2dc9] commit 1 Author: Bash Author <[email protected]> Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (5aa2dc979632e41770014678a2c829369d7eea9a => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD'] {'check': True} c67e6e4a4c25 commit 1 Updating refs/heads/master (960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0 => c67e6e4a4c25442f3cdf55d03a57639697420357) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--gpg-sign'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (c67e6e4a4c25442f3cdf55d03a57639697420357 => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--no-gpg-sign'] {'check': True} c67e6e4a4c25 commit 1 Updating refs/heads/master (960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0 => c67e6e4a4c25442f3cdf55d03a57639697420357) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '-S'] {'check': True} 960d4c0a13a4 commit 1 Updating refs/heads/master (c67e6e4a4c25442f3cdf55d03a57639697420357 => 960d4c0a13a46b43af7aff0d7cb8ea6f4546f7b0) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD', '--gpg-sign'] {'check': True} subprocess exited with non-zero status: 1 [master 6a92b96] commit 2 Author: Bash Author <[email protected]> [master 07435aa] commit 3 Author: Bash Author <[email protected]> [master 33cebdc] commit 4 Author: Bash Author <[email protected]> Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~~', '--gpg-sign'] {'check': True} 2b2c0313c39a commit 2 6932b3a0cd34 commit 3 018843b015b2 commit 4 Updating refs/heads/master (33cebdc30539bfeb0fc5e5530d1eee3fda277be1 => 018843b015b2221d9d87e10590dee48d90075f7a) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~', '--no-gpg-sign'] {'check': True} 8e096b818b34 commit 3 af3a5ac5a196 commit 4 Updating refs/heads/master (018843b015b2221d9d87e10590dee48d90075f7a => af3a5ac5a196d0bef501e14b57fb33e3b683e947) Running ['/home/runner/work/git-revise/git-revise/.tox/py36/bin/python', '-m', 'gitrevise', 'HEAD~~', '--gpg-sign'] {'check': True} 2b2c0313c39a commit 2 6932b3a0cd34 commit 3 018843b015b2 commit 4 Updating refs/heads/master (af3a5ac5a196d0bef501e14b57fb33e3b683e947 => 018843b015b2221d9d87e10590dee48d90075f7a) ----------------------------- Captured stderr call ----------------------------- gpg: keybox '/tmp/tmpdqw8v4oq/pubring.kbx' created gpg: /tmp/tmpdqw8v4oq/trustdb.gpg: trustdb created gpg: key 1B1CE6765D1A672E marked as ultimately trusted gpg: directory '/tmp/tmpdqw8v4oq/openpgp-revocs.d' created gpg: revocation certificate stored as '/tmp/tmpdqw8v4oq/openpgp-revocs.d/844AB55D2239CF1037507DA71B1CE6765D1A672E.rev' gpg failed to sign commit
krobelus
force-pushed
the
try-fix-gpg-agent-cleanup
branch
from
October 4, 2021 19:26
378a5d3
to
e485678
Compare
rwe
approved these changes
Oct 6, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new GPG tests fail occasionally, for example in
https://github.com/mystor/git-revise/pull/99/checks?check_run_id=3785380820
An excerpt from the job log is added below.
I'm not sure if problem is the
or the
line; neither should happen.
The first sounds like a race between the GPG agent shutdown and the
cleanup of the test's temp dir. Try to fix that by stopping the agent
before cleanup. Intuitively, this fix makes sense because it's
probably not normal to remove $GNUPGHOME while gpg-agent is running.
Extract everything that handles our temporary $GNUPGHOME to a fixture,
so we can include a cleanup step.
This could be tested by repeating this in the CI a
number of times but I'm not sure if that's worth it.
Unfortunately, the "gpg failed to sign commit" (very last line of
the log below) does not tell us which one failed but that probably
wouldn't help either.