[Rt-commit] rt branch, 5.0/fix-skipped-gpg-tests, created. rt-5.0.0beta2-90-ge29851a6ef

? sunnavy sunnavy at bestpractical.com
Wed Jul 15 10:46:20 EDT 2020


The branch, 5.0/fix-skipped-gpg-tests has been created
        at  e29851a6efd13358bf085a8be6e20392287747a5 (commit)

- Log -----------------------------------------------------------------
commit be000f97ec02be9a35666981f8f26671b75e2312
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jul 15 19:47:50 2020 +0800

    Don't clean gpg stuff if tests are skipped
    
    We skip gpg tests if current gpg env is not suitable, e.g. when there is
    no gpg command or the gpg version is incompatible with GnuPG::Interface.
    
    For cases like that, the unnecessary cleanup code could fail, so here we
    skip it.

diff --git a/lib/RT/Test/GnuPG.pm b/lib/RT/Test/GnuPG.pm
index 2d6a8ab720..71b76dc323 100644
--- a/lib/RT/Test/GnuPG.pm
+++ b/lib/RT/Test/GnuPG.pm
@@ -405,7 +405,7 @@ sub new_homedir {
 }
 
 END {
-    if ( gnupg_version() >= 2 ) {
+    if ( RT::Test->builder()->has_plan && gnupg_version() >= 2 ) {
         system( 'gpgconf', '--homedir', RT->Config->Get('GnuPGOptions')->{homedir}, '--quiet', '--kill', 'gpg-agent' )
             && warn $!;
     }

commit e29851a6efd13358bf085a8be6e20392287747a5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jul 15 20:28:31 2020 +0800

    Skip gpg homedir creation if tests are going to be skipped
    
    Not just because it's unnecessary, but it also could cause some tests to
    fail as we check gpg version in homedir creation, and the version check
    code could die if there is no gpg command or GnuPG::Interface, or the
    gpg command is incompatible with GnuPG::Interface.
    
    We do skip gpg tests for above cases either automatically or by setting
    env SKIP_GPG_TESTS=1, but tests like t/mail/gnupg-incoming.t create gpg
    homedir earlier than the skip logic, so we need to add similar skip
    logic in homedir creation code.

diff --git a/lib/RT/Test/GnuPG.pm b/lib/RT/Test/GnuPG.pm
index 71b76dc323..f14c892529 100644
--- a/lib/RT/Test/GnuPG.pm
+++ b/lib/RT/Test/GnuPG.pm
@@ -387,6 +387,7 @@ sub gnupg_version {
 
 sub new_homedir {
     my $source = shift;
+    return if $ENV{'SKIP_GPG_TESTS'} || !RT::Test->find_executable('gpg') || !GnuPG::Interface->require;
     my $dir = tempdir();
 
     if ($source) {

-----------------------------------------------------------------------


More information about the rt-commit mailing list