Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify pcs command expectation #328

Merged
merged 1 commit into from
Aug 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spec/spec_helper_corosync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ def not_expect_commands(patterns)
end
end
end

shared_context 'pcs' do
before do
described_class.stubs(:command).with(:pcs).returns 'pcs'
described_class.expects(:block_until_ready).returns(nil).at_most(1)
end
end
5 changes: 1 addition & 4 deletions spec/unit/puppet/provider/cs_clone_pcs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
require 'spec_helper_corosync'

describe Puppet::Type.type(:cs_clone).provider(:pcs) do
before do
described_class.stubs(:command).with(:pcs).returns 'pcs'
end
include_context 'pcs'

context 'when getting instances' do
let :instances do
Expand All @@ -24,7 +22,6 @@
</cib>
EOS

described_class.expects(:block_until_ready).returns(nil)
Puppet::Util::Execution.expects(:execute).with(%w(pcs cluster cib), failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution::ProcessOutput.new(test_cib, 0)
)
Expand Down
5 changes: 1 addition & 4 deletions spec/unit/puppet/provider/cs_order_pcs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
require 'spec_helper'

describe Puppet::Type.type(:cs_order).provider(:pcs) do
before do
described_class.stubs(:command).with(:pcs).returns 'pcs'
described_class.expects(:block_until_ready).returns(nil)
end
include_context 'pcs'

let :test_cib do
<<-EOS
Expand Down
5 changes: 1 addition & 4 deletions spec/unit/puppet/provider/cs_primitive_pcs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
require 'spec_helper_corosync'

describe Puppet::Type.type(:cs_primitive).provider(:pcs) do
before do
described_class.stubs(:command).with(:pcs).returns 'pcs'
end
include_context 'pcs'

context 'when getting instances' do
let :instances do
Expand Down Expand Up @@ -32,7 +30,6 @@
</configuration>
EOS

described_class.expects(:block_until_ready).returns(nil)
Puppet::Util::Execution.expects(:execute).with(%w(pcs cluster cib), failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution::ProcessOutput.new(test_cib, 0)
)
Expand Down
5 changes: 1 addition & 4 deletions spec/unit/puppet/provider/cs_property_pcs_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require 'spec_helper'

describe Puppet::Type.type(:cs_property).provider(:pcs) do
before do
described_class.stubs(:command).with(:pcs).returns 'pcs'
end
include_context 'pcs'

context 'when getting instances' do
let :instances do
Expand All @@ -23,7 +21,6 @@
</cib>
EOS

described_class.expects(:block_until_ready).returns(nil)
Puppet::Util::Execution.expects(:execute).with(%w(pcs cluster cib), failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution::ProcessOutput.new(test_cib, 0)
)
Expand Down