1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
# frozen_string_literal: true
require 'spec_helper'
describe 'ssh::hostkeys', type: 'class' do
_, os_facts = on_supported_os.first
let(:facts) { os_facts }
context 'with tags' do
let(:params) do
{
tags: %w[group1 group2]
}
end
%w[rsa].each do |key_type|
it {
expect(exported_resources).to contain_sshkey("foo.example.com_#{key_type}").
with(
ensure: 'present',
type: %r{^#{key_type}},
tag: %w[group1 group2]
)
}
end
end
context 'with storeconfigs_group' do
let(:params) do
{
storeconfigs_group: 'server_group',
}
end
%w[rsa].each do |key_type|
it {
expect(exported_resources).to contain_sshkey("foo.example.com_#{key_type}").
with(
ensure: 'present',
type: %r{^#{key_type}},
tag: %w[hostkey_all hostkey_server_group]
)
}
end
end
context 'with storeconfigs_group and tags' do
let(:params) do
{
storeconfigs_group: 'server_group',
tags: %w[group1 group2],
}
end
%w[rsa].each do |key_type|
it {
expect(exported_resources).to contain_sshkey("foo.example.com_#{key_type}").
with(
ensure: 'present',
type: %r{^#{key_type}},
tag: %w[hostkey_all hostkey_server_group group1 group2]
)
}
end
end
end
|