【发布时间】:2015-11-09 01:04:42
【问题描述】:
我有一些 beaker-rspec 验收测试涵盖了我正在创建的 Puppet 模块,并且想知道如何在底层 Puppet 调用上启用调试日志记录(例如,确切知道当我调用 apply_manifest 时会发生什么)。我很确定我已经能够在 Beaker 本身 (export BEAKER_debug=yes?) 上进行调试日志记录,但这似乎只是告诉我 Beaker 在做什么,不一定是 Puppet。
如果有帮助,这里有一些相关的文件sn-ps:
spec/fixtures/spec_helper_acceptance.rb
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
require 'beaker/librarian'
RSpec.configure do |c|
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
install_puppet
install_librarian
librarian_install_modules(module_root, 'mymodule')
end
end
spec/acceptance/example_spec.rb
require 'spec_helper_acceptance'
apply_manifest_opts = {
:catch_failures => true,
# I seem to need this otherwise Puppet doesn't pick up the required modules.
# Is this where I can also enable debug logging in Puppet?
:modulepath => '/etc/puppetlabs/puppet/modules/',
}
default_pp = <<-EOS
class { 'mymodule': }
EOS
describe 'the mymodule class' do
describe 'given default params' do
it 'should return successfully' do
expect(apply_manifest(default_pp, apply_manifest_opts).exit_code).to be_zero
end
end
end
我实际上正在尝试找出 the mymodule class given default params should return successfully 测试失败的原因,但目前我只得到了
Failure/Error: expect(apply_manifest(default_pp, apply_manifest_opts).exit_code).to be_zero
expected `2.zero?` to return true, got false
这没什么帮助。你看到我的问题了吗?
我会接受直接回答我的问题的回复,或者给我一些其他方式来解决为什么退出代码是非零的。
【问题讨论】:
标签: ruby logging rspec puppet beaker