diff options
author | Felix Frank <Felix.Frank@Alumni.TU-Berlin.de> | 2014-10-14 00:25:53 +0200 |
---|---|---|
committer | Felix Frank <Felix.Frank@Alumni.TU-Berlin.de> | 2014-10-15 19:52:45 +0200 |
commit | 2a0eaac7321f199e023fd9500cfab64cfd6544ce (patch) | |
tree | d61011736ee894282a636f40a58324faa1235e17 /spec | |
parent | c9fd8dcb8c1860e80215a3d9fa1ee7fedec0ec2e (diff) | |
download | puppet-2a0eaac7321f199e023fd9500cfab64cfd6544ce.tar.gz |
(PUP-3357) integration test for purging of unnamed ssh authorized keys
Add an integration test with an ssh keyfile in which two keys have no name
and make sure that both are successfully purged.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/integration/type/user_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/integration/type/user_spec.rb b/spec/integration/type/user_spec.rb index 4724fe9d5..c542e51a9 100644 --- a/spec/integration/type/user_spec.rb +++ b/spec/integration/type/user_spec.rb @@ -8,7 +8,13 @@ describe Puppet::Type.type(:user), '(integration)', :unless => Puppet.features.m include PuppetSpec::Compiler context "when set to purge ssh keys from a file" do - let(:tempfile) { file_containing('user_spec', "# comment\nssh-rsa KEY-DATA key-name\nssh-rsa KEY-DATA key name\n") } + let(:tempfile) do + file_containing('user_spec', <<-EOF) + # comment + ssh-rsa KEY-DATA key-name + ssh-rsa KEY-DATA key name + EOF + end # must use an existing user, or the generated key resource # will fail on account of an invalid user for the key # - root should be a safe default @@ -32,5 +38,20 @@ describe Puppet::Type.type(:user), '(integration)', :unless => Puppet.features.m File.read(tempfile).should_not =~ /key-name/ end end + + context "with multiple unnamed keys" do + let(:tempfile) do + file_containing('user_spec', <<-EOF) + # comment + ssh-rsa KEY-DATA1 + ssh-rsa KEY-DATA2 + EOF + end + + it "should purge authorized ssh keys" do + apply_compiled_manifest(manifest) + File.read(tempfile).should_not =~ /KEY-DATA/ + end + end end end |