Created
March 30, 2015 10:24
-
-
Save trekr5/e7e9deb528800a4775ee to your computer and use it in GitHub Desktop.
chefspec test to ensure that decrypted databag returns data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'core::local_users_linux' do | |
let (:chef_run) { ChefSpec::SoloRunner.new.converge('core::local_users_linux') } | |
let(:databag){Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")} | |
before do | |
allow(databag).and_return({ | |
"id" => "svc_goagent", | |
"password" => "London2014" | |
}) | |
end | |
context 'linux' do | |
it 'stubbed databag does not raise error with aws-admin-passwords databag and svc_goagent id' do | |
expect(chef_run).to_not raise_error | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finished in 19.24 seconds (files took 1 minute 45.03 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/local_users_linux_spec.rb:31 # core::local_users_linux linux stubbed databag does not raise error with aws-admin-passwords databag and svc_goagent id
No Chef resources found, skipping coverage calculation...
c:\git\cookbook-core>rspec spec/local_users_linux_spec.rb
ffi-yajl/json_gem is deprecated, these monkeypatches will be dropped shortly
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
[2015-03-30T11:17:58+01:00] WARN: Failed to read the private key C:\chef\client.pem: #<Errno::ENOENT: No such file or directory - C:\chef\client.pem>
F
Failures:
Failure/Error:
Chef::Exceptions::PrivateKeyMissing:
I cannot read C:\chef\client.pem, which you told me to use to sign requests!
./spec/local_users_linux_spec.rb:21:in `block (2 levels) in <top (required)>'
./spec/local_users_linux_spec.rb:13:in`block (2 levels) in <top (required)>'
Finished in 16.64 seconds (files took 1 minute 34.44 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/local_users_linux_spec.rb:33 # core::local_users_linux linux stubbed databag does not raise error with aws-admin-passwords databag and svc_goagent id
No Chef resources found, skipping coverage calculation...