Skip to content

Commit

Permalink
Fix testing on puppet 6
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Oct 14, 2018
1 parent f873727 commit 3515948
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifests/repo/apt.pp
Expand Up @@ -26,7 +26,7 @@
key => {
'id' => $key,
'source' => $key_source,
'content' => $key_content,
'content' => $key_content,
},
architecture => $architecture,
}
Expand Down
16 changes: 14 additions & 2 deletions spec/classes/rabbitmq_spec.rb
Expand Up @@ -91,12 +91,18 @@
context 'with no pin', if: facts[:os]['family'] == 'Debian' do
let(:params) { { repos_ensure: true, package_apt_pin: '' } }

if Puppet.version =~ %r{^6} # https://tickets.puppetlabs.com/browse/PUP-9112 and https://tickets.puppetlabs.com/browse/PUP-9180
let(:expected_key_apt_source_key_content) { 'nil' }
else
let(:expected_key_apt_source_key_content) { ':undef' }
end

describe 'it sets up an apt::source' do
it {
is_expected.to contain_apt__source('rabbitmq').with(
'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{facts[:os]['name'].downcase}",
'repos' => 'main',
'key' => '{"id"=>"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB", "source"=>"https://packagecloud.io/gpg.key", "content"=>:undef}'
'key' => "{\"id\"=>\"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB\", \"source\"=>\"https://packagecloud.io/gpg.key\", \"content\"=>#{expected_key_apt_source_key_content}}"
)
}
end
Expand All @@ -105,12 +111,18 @@
context 'with pin', if: facts[:os]['family'] == 'Debian' do
let(:params) { { repos_ensure: true, package_apt_pin: '700' } }

if Puppet.version =~ %r{^6} # https://tickets.puppetlabs.com/browse/PUP-9112 and https://tickets.puppetlabs.com/browse/PUP-9180
let(:expected_key_apt_source_key_content) { 'nil' }
else
let(:expected_key_apt_source_key_content) { ':undef' }
end

describe 'it sets up an apt::source and pin' do
it {
is_expected.to contain_apt__source('rabbitmq').with(
'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{facts[:os]['name'].downcase}",
'repos' => 'main',
'key' => '{"id"=>"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB", "source"=>"https://packagecloud.io/gpg.key", "content"=>:undef}'
'key' => "{\"id\"=>\"418A7F2FB0E1E6E7EABF6FE8C2E73424D59097AB\", \"source\"=>\"https://packagecloud.io/gpg.key\", \"content\"=>#{expected_key_apt_source_key_content}}"
)
}

Expand Down

0 comments on commit 3515948

Please sign in to comment.