aboutsummaryrefslogtreecommitdiff
path: root/spec/integration/provider
diff options
context:
space:
mode:
authorCiprian Badescu <ciprian.badescu@puppet.com>2020-02-20 15:32:52 +0200
committerCiprian Badescu <ciprian.badescu@puppet.com>2020-02-25 14:27:27 +0200
commit92a734a6620fcc51691d60347e344f87ac801bde (patch)
tree8309796c9485c084ec87cd84d26d17ecfb904213 /spec/integration/provider
parent9f710d8e502b5bf2ca3d213d2bddea13f7a4b7b8 (diff)
downloadpuppet-sshkeys_core-92a734a6620fcc51691d60347e344f87ac801bde.tar.gz
puppet-sshkeys_core-92a734a6620fcc51691d60347e344f87ac801bde.tar.bz2
(MODULES-7613) use name and type as composite namevar
After this modification it will be possible to add two or more keys of different types for the same host
Diffstat (limited to 'spec/integration/provider')
-rw-r--r--spec/integration/provider/sshkey_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/integration/provider/sshkey_spec.rb b/spec/integration/provider/sshkey_spec.rb
index 4a3bf87..5f30db1 100644
--- a/spec/integration/provider/sshkey_spec.rb
+++ b/spec/integration/provider/sshkey_spec.rb
@@ -52,9 +52,29 @@ describe Puppet::Type.type(:sshkey).provider(:parsed), unless: Puppet.features.m
expect(File.read(sshkey_file)).to match(%r{#{super_unique}.*mykey})
end
+ it 'creates two SSH host key entries with two keys (ensure present)' do
+ manifest = "
+ #{type_under_test} { '#{super_unique}_rsa':
+ ensure => 'present',
+ type => 'rsa',
+ name => '#{super_unique}',
+ key => 'myrsakey',
+ target => '#{sshkey_file}', }
+ #{type_under_test} { '#{super_unique}_dss':
+ ensure => 'present',
+ type => 'ssh-dss',
+ name => '#{super_unique}',
+ key => 'mydsskey',
+ target => '#{sshkey_file}' }"
+ apply_with_error_check(manifest)
+ expect(File.read(sshkey_file)).to match(%r{#{super_unique}.*myrsakey})
+ expect(File.read(sshkey_file)).to match(%r{#{super_unique}.*mydsskey})
+ end
+
it 'deletes an entry for an SSH host key' do
manifest = "#{type_under_test} { '#{sshkey_name}':
ensure => 'absent',
+ type => 'rsa',
target => '#{sshkey_file}' }"
apply_with_error_check(manifest)
expect(File.read(sshkey_file)).not_to match(%r{#{sshkey_name}.*Yqk0=})
@@ -121,6 +141,7 @@ describe Puppet::Type.type(:sshkey).provider(:parsed), unless: Puppet.features.m
it 'updates an entry with a single new host_alias' do
manifest = "#{type_under_test} { '#{sshkey_name}':
ensure => 'present',
+ type => 'rsa',
host_aliases => '#{host_alias}',
target => '#{sshkey_file}' }"
apply_with_error_check(manifest)
@@ -132,6 +153,7 @@ describe Puppet::Type.type(:sshkey).provider(:parsed), unless: Puppet.features.m
it 'updates an entry with multiple new host_aliases' do
manifest = "#{type_under_test} { '#{sshkey_name}':
ensure => 'present',
+ type => 'rsa',
host_aliases => [ 'r0ckdata.com', 'erict.net' ],
target => '#{sshkey_file}' }"
apply_with_error_check(manifest)