[DRE-commits] [ruby-mail-gpg] 01/02: debian/ruby-tests.rake: Fix failing CI tests

Georg Faerber georg-alioth-guest at moszumanska.debian.org
Fri Nov 25 21:54:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

georg-alioth-guest pushed a commit to branch master
in repository ruby-mail-gpg.

commit 90993c9f38b8dfdd8e49524a015cae819e0ba8a9
Author: Georg Faerber <georg at riseup.net>
Date:   Thu Nov 24 17:17:47 2016 +0100

    debian/ruby-tests.rake: Fix failing CI tests
    
    The tests were failing if executed in a LXC environment, due to a deep
    folder hierarchy, leading to "gnupg-agent: socket name [...] is too
    long". This commit makes use of a tmpdir, to be used as the gpghome,
    with a shorter path.
    
    Additonally, it introduces a 'cleanup' task, which kills the gnupg
    agent, to enable clean unmounting, and unsets the 'GNUPGHOME'
    environment variable.
---
 debian/ruby-tests.rake | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
index d4b2f34..962d9ce 100644
--- a/debian/ruby-tests.rake
+++ b/debian/ruby-tests.rake
@@ -1,19 +1,26 @@
 require 'rake/testtask'
 require 'pathname'
+require 'tmpdir'
 
 def setup_gpghome
-  gpghome = File.join File.dirname(File.dirname(__FILE__)), 'test', 'gpghome'
-  ENV['GNUPGHOME'] = gpghome
+  gpghome_upstream = File.join File.dirname(File.dirname(__FILE__)), 'test', 'gpghome'
+  gpghome_tmp = Dir.mktmpdir("ruby-mail-gpg-#{Time.now.to_i}-#{rand(100)}")
+  ENV['GNUPGHOME'] = gpghome_tmp
   ENV['GPG_AGENT_INFO'] = '' # disable gpg agent
+  sh "cp -r #{gpghome_upstream}/* #{gpghome_tmp}/"
 end
 
-task :default => ["mail_gpg:tests:setup", :test]
+task :default => ["mail_gpg:tests:setup", :test, "mail_gpg:tests:cleanup"]
 
 namespace :mail_gpg do
   namespace :tests do
     task :setup do
       setup_gpghome
     end
+    task :cleanup do
+      sh 'gpgconf --kill gpg-agent'
+      ENV['GNUPGHOME'] = nil
+    end
   end
 end
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-mail-gpg.git



More information about the Pkg-ruby-extras-commits mailing list