apt-key doesn't add long keys in deb6
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / apt_key_provider_spec.rb
index 69f7a930f6c1b80668f8d0ae6ad4341310ae3486..3f2536c7f09819760b723da13535ab5abf4d6ff1 100644 (file)
@@ -64,6 +64,32 @@ describe 'apt_key' do
 
   describe 'ensure =>' do
     context 'absent' do
+      it 'is removed' do
+        pp = <<-EOS
+        apt_key { 'centos':
+          id     => '#{CENTOS_GPG_KEY_ID}',
+          ensure => 'absent',
+        }
+        EOS
+
+        # Install the key first
+        shell("apt-key adv --keyserver keyserver.ubuntu.com \
+              --recv-keys #{CENTOS_GPG_KEY_ID}")
+        shell("apt-key list | grep #{CENTOS_GPG_KEY_ID}")
+
+        # Time to remove it using Puppet
+        apply_manifest(pp, :catch_failures => true)
+        apply_manifest(pp, :catch_failures => true)
+
+        shell("apt-key list | grep #{CENTOS_GPG_KEY_ID}",
+              :acceptable_exit_codes => [1])
+
+        shell("apt-key adv --keyserver keyserver.ubuntu.com \
+              --recv-keys #{CENTOS_GPG_KEY_ID}")
+      end
+    end
+
+    context 'absent, added with long key', :unless => (fact('operatingsystem') == 'Debian' and fact('operatingsystemmajrelease') == '6') do
       it 'is removed' do
         pp = <<-EOS
         apt_key { 'puppetlabs':