test error raised if the primitive has the wrong agent
This commit is contained in:
@@ -31,7 +31,8 @@ action :create do
|
|||||||
create_resource(name)
|
create_resource(name)
|
||||||
else
|
else
|
||||||
if @current_resource.agent != new_resource.agent
|
if @current_resource.agent != new_resource.agent
|
||||||
raise "Existing primitive '#{name}' has agent but recipe wanted #{new_resource.agent}"
|
raise "Existing primitive '#{name}' has agent '#{@current_resource.agent}' " \
|
||||||
|
"but recipe wanted '#{new_resource.agent}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
modify_resource(name)
|
modify_resource(name)
|
||||||
|
@@ -71,7 +71,19 @@ describe "Chef::Provider::PacemakerPrimitive" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should barf if the primitive has the wrong agent" do
|
it "should barf if the primitive has the wrong agent" do
|
||||||
pending "not implemented yet"
|
existing_agent = "ocf:openstack:something-else"
|
||||||
|
config = ra[:config].sub(ra[:agent], existing_agent)
|
||||||
|
provider = Chef::Provider::PacemakerPrimitive.new(@resource, @run_context)
|
||||||
|
|
||||||
|
# get_cib_object_definition is invoked by load_current_resource
|
||||||
|
# and later used to see whether to create or modify.
|
||||||
|
expect(provider).to receive(:get_cib_object_definition).and_return(config)
|
||||||
|
|
||||||
|
expected_error = \
|
||||||
|
"Existing primitive '#{ra[:name]}' has agent '#{existing_agent}' " \
|
||||||
|
"but recipe wanted '#{@resource.agent}'"
|
||||||
|
expect { provider.run_action :create }.to \
|
||||||
|
raise_error(RuntimeError, expected_error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user