View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
No changes.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -1,2 +1 @@
require 'systemu'
require 'json'
View
@@ -49,8 +49,7 @@ def spark(resp_times)
end
def main
client = MCollective::Client.new(options[:config])
client.options = options
client = MCollective::Client.new(options)
start = Time.now.to_f
times = []
View
@@ -301,7 +301,7 @@ def prepare_plugin
mcdependency = {:mcname => configuration[:mcname], :mcversion => configuration[:mcversion]}
#Deprecation warning for --iteration
# Deprecation warning for --iteration
if configuration[:iteration]
puts 'Warning. The --iteration flag has been deprecated. Please use --revision instead.'
configuration[:revision] = configuration[:iteration] unless configuration[:revision]
@@ -310,16 +310,16 @@ def prepare_plugin
plugin_class.new(configuration, mcdependency, plugintype)
end
def directory_for_type(type)
File.directory?(File.join(configuration[:target], type))
def plugin_directory_exists?(plugin_type)
File.directory?(File.join(PluginPackager.get_plugin_path(configuration[:target]), plugin_type))
end
# Identify plugin type if not provided.
def set_plugin_type
if directory_for_type("agent") || directory_for_type("application")
if plugin_directory_exists?("agent") || plugin_directory_exists?("application")
configuration[:plugintype] = "AgentDefinition"
return "Agent"
elsif directory_for_type(plugintype = identify_plugin)
elsif plugin_directory_exists?(plugintype = identify_plugin)
configuration[:plugintype] = "StandardDefinition"
return plugintype
else
@@ -330,9 +330,11 @@ def set_plugin_type
# If plugintype is StandardDefinition, identify which of the special
# plugin types we are dealing with based on directory structure.
# To keep it simple we limit it to one type per target directory.
# Return the name of the type of plugin as a string
def identify_plugin
plugintype = Dir.glob(File.join(configuration[:target], "*")).select do |file|
File.directory?(file) && file.match(/(connector|facts|registration|security|audit|pluginpackager|data|discovery|validator)/)
File.directory?(file) &&
file.match(/(connector|facts|registration|security|audit|pluginpackager|data|discovery|validator)/)
end
raise RuntimeError, "more than one plugin type detected in directory" if plugintype.size > 1
View
@@ -151,7 +151,27 @@ def on_ssl_connectfail(params)
# Stomp 1.1+ - heart beat read (receive) failed.
def on_hbread_fail(params, ticker_data)
Log.error("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
if ticker_data["lock_fail"]
if params[:max_hbrlck_fails] == 0
# failure is disabled
Log.debug("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
elsif ticker_data['lock_fail_count'] >= params[:max_hbrlck_fails]
# we're about to force a disconnect
Log.error("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
else
Log.warn("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
end
else
if params[:max_hbread_fails] == 0
# failure is disabled
Log.debug("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
elsif ticker_data['read_fail_count'] >= params[:max_hbread_fails]
# we're about to force a reconnect
Log.error("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
else
Log.warn("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
end
end
rescue Exception => e
end
@@ -187,6 +207,8 @@ def initialize
@back_off_multiplier = Integer(get_option("activemq.back_off_multiplier", 2))
@max_reconnect_delay = Float(get_option("activemq.max_reconnect_delay", 30.0))
@reconnect_delay = @initial_reconnect_delay
Log.info("ActiveMQ connector initialized. Using stomp-gem #{stomp_version}")
end
# Connects to the ActiveMQ middleware
@@ -238,12 +260,15 @@ def connect(connector = ::Stomp::Connection)
connection[:connect_timeout] = Integer(get_option("activemq.connect_timeout", 30))
connection[:reliable] = true
connection[:connect_headers] = connection_headers
connection[:max_hbrlck_fails] = Integer(get_option("activemq.max_hbrlck_fails", 2))
connection[:max_hbrlck_fails] = Integer(get_option("activemq.max_hbrlck_fails", 0))
connection[:max_hbread_fails] = Integer(get_option("activemq.max_hbread_fails", 2))
connection[:logger] = EventLogger.new
@connection = connector.new(connection)
rescue ClientTimeoutError => e
raise e
rescue Exception => e
raise("Could not connect to ActiveMQ Server: #{e}")
end
@@ -479,6 +504,8 @@ def headers_for(msg, identity=nil)
headers["mc_identity"] = identity if msg.type == :direct_request
end
headers["mc_sender"] = Config.instance.identity
return headers
end
View
@@ -47,7 +47,27 @@ def on_ssl_connectfail(params)
# Stomp 1.1+ - heart beat read (receive) failed.
def on_hbread_fail(params, ticker_data)
Log.error("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
if ticker_data["lock_fail"]
if params[:max_hbrlck_fails] == 0
# failure is disabled
Log.debug("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
elsif ticker_data['lock_fail_count'] >= params[:max_hbrlck_fails]
# we're about to force a disconnect
Log.error("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
else
Log.warn("Heartbeat failed to acquire readlock for '%s': %s" % [stomp_url(params), ticker_data.inspect])
end
else
if params[:max_hbread_fails] == 0
# failure is disabled
Log.debug("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
elsif ticker_data['read_fail_count'] >= params[:max_hbread_fails]
# we're about to force a reconnect
Log.error("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
else
Log.warn("Heartbeat read failed from '%s': %s" % [stomp_url(params), ticker_data.inspect])
end
end
rescue Exception => e
end
@@ -82,6 +102,8 @@ def initialize
@back_off_multiplier = Integer(get_option("rabbitmq.back_off_multiplier", 2))
@max_reconnect_delay = Float(get_option("rabbitmq.max_reconnect_delay", 30.0))
@reconnect_delay = @initial_reconnect_delay
Log.info("RabbitMQ connector initialized. Using stomp-gem #{stomp_version}")
end
# Connects to the RabbitMQ middleware
@@ -132,14 +154,17 @@ def connect(connector = ::Stomp::Connection)
connection[:timeout] = Integer(get_option("rabbitmq.timeout", -1))
connection[:connect_timeout] = Integer(get_option("rabbitmq.connect_timeout", 30))
connection[:reliable] = true
connection[:max_hbrlck_fails] = Integer(get_option("rabbitmq.max_hbrlck_fails", 2))
connection[:max_hbrlck_fails] = Integer(get_option("rabbitmq.max_hbrlck_fails", 0))
connection[:max_hbread_fails] = Integer(get_option("rabbitmq.max_hbread_fails", 2))
connection[:connect_headers] = connection_headers
connection[:logger] = EventLogger.new
@connection = connector.new(connection)
rescue ClientTimeoutError => e
raise e
rescue Exception => e
raise("Could not connect to RabbitMQ Server: #{e}")
end
@@ -326,6 +351,8 @@ def target_for(msg, node=nil)
# rather than in make_target as this should only be set on publish
target[:headers]["expiration"] = ((msg.ttl + 10) * 1000).to_s
target[:headers]["mc_sender"] = Config.instance.identity
return target
end
View
@@ -0,0 +1,20 @@
metadata :name => "Collective",
:description => "Collective membership",
:author => "Puppet Labs",
:license => "ASL 2.0",
:version => "1.0",
:url => "http://marionette-collective.org/",
:timeout => 1
dataquery :description => "Collective" do
input :query,
:prompt => 'Collective',
:description => 'Collective name to ask about, eg mcollective',
:type => :string,
:validation => /./,
:maxlength => 256
output :member,
:description => 'Node is a member of the named collective',
:display_as => 'member'
end
View
@@ -0,0 +1,9 @@
module MCollective
module Data
class Collective_data<Base
query do |collective|
result[:member] = Config.instance.collectives.include?(collective)
end
end
end
end
View
@@ -60,7 +60,7 @@ def make_module
# for each subpackage make a subclass
@plugin.packagedata.each do |klass,data|
data[:files].each do |file|
relative_path = file.sub(/^\.\//, '')
relative_path = File.expand_path(file).gsub(/#{@plugin.target_path}|^\.\//, '')
targetdir = File.join(@tmpdir, 'files', klass.to_s, 'mcollective', File.dirname(relative_path))
FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
FileUtils.cp_r(file, targetdir)
View
@@ -4,6 +4,6 @@ class <%= @package_name %>::<%= @klass %> {
include ::<%= @package_name %>::common
<% end %>
mcollective::plugin { '<%= @package_name %>/<%= @klass %>':
source => 'puppet:///modules/<%= @package_name %>/<% @klass %>',
source => 'puppet:///modules/<%= @package_name %>/<%= @klass %>',
}
}
View
@@ -4,7 +4,13 @@
module MCollective
describe Client do
before do
let(:client) do
c = Client.new("/nonexisting")
c.options = Util.default_options
c
end
before :each do
@security = mock
@security.stubs(:initiated_by=)
@connector = mock
@@ -20,9 +26,19 @@ module MCollective
Config.instance.instance_variable_set("@configured", true)
PluginManager.expects("[]").with("connector_plugin").returns(@connector)
PluginManager.expects("[]").with("security_plugin").returns(@security)
Timeout.stubs(:timeout).with(nil, MCollective::ClientTimeoutError)
end
@client = Client.new("/nonexisting")
@client.options = Util.default_options
describe "#initialize" do
it "should set a timeout if a timeout has been specified" do
Timeout.expects(:timeout).with(1, MCollective::ClientTimeoutError)
Client.new({:config => "/nonexisting", :connection_timeout => 1})
end
it "should try forever if no timeout has been set" do
Timeout.expects(:timeout).with(nil, MCollective::ClientTimeoutError)
Client.new({:config => "/nonexisting"})
end
end
describe "#sendreq" do
@@ -31,10 +47,10 @@ module MCollective
request.stubs(:agent)
request.stubs(:ttl)
request.stubs(:collective)
@client.expects(:createreq).with(request, "rspec", {}).returns(request)
client.expects(:createreq).with(request, "rspec", {}).returns(request)
request.expects(:publish)
request.expects(:requestid).returns("13fegbcw").twice
result = @client.sendreq(request, "rspec")
result = client.sendreq(request, "rspec")
result.should == "13fegbcw"
end
end
@@ -43,36 +59,36 @@ module MCollective
it "should create a request" do
message = Message.new("rspec", nil, {:agent => "rspec", :type => :request, :collective => "mcollective", :filter => Util.empty_filter, :options => Util.default_options})
message.stubs(:encode!)
@client.stubs(:subscribe)
client.stubs(:subscribe)
message.stubs(:reply_to)
result = @client.createreq(message, "rspec")
result = client.createreq(message, "rspec")
result.should == message
end
it "should create a new request if the message if not of type Message" do
message = mock
message.stubs(:encode!)
@client.stubs(:subscribe)
client.stubs(:subscribe)
message.stubs(:reply_to)
Message.expects(:new).returns(message)
result = @client.createreq("message", "rspec")
result = client.createreq("message", "rspec")
result.should == message
end
it "should subscripe to the reply queue unless has been specified" do
message = Message.new("rspec", nil, {:agent => "rspec", :type => :request, :collective => "mcollective", :filter => Util.empty_filter, :options => Util.default_options})
message.stubs(:encode!)
@client.expects(:subscribe).with("rspec", :reply)
client.expects(:subscribe).with("rspec", :reply)
message.stubs(:reply_to).returns(nil)
@client.createreq(message, "rspec")
client.createreq(message, "rspec")
end
it "should not subscribe to the reply queue if one has been specified" do
message = Message.new("rspec", nil, {:agent => "rspec", :type => :request, :collective => "mcollective", :filter => Util.empty_filter, :options => Util.default_options})
message.stubs(:encode!)
@client.expects(:subscribe).never
client.expects(:subscribe).never
message.stubs(:reply_to).returns(:reply)
@client.createreq(message, "rspec")
client.createreq(message, "rspec")
end
end
@@ -81,75 +97,85 @@ module MCollective
subscription = mock
Util.stubs(:make_subscriptions).returns(subscription)
Util.expects(:subscribe).with(subscription)
@client.subscribe("rspec", :queue)
@client.instance_variable_get(:@subscriptions).should == {"rspec" => 1}
client.subscribe("rspec", :queue)
client.instance_variable_get(:@subscriptions).should == {"rspec" => 1}
end
it "should not subscribe to a destination if it already has" do
@client.instance_variable_get(:@subscriptions)["rspec"] = 1
client.instance_variable_get(:@subscriptions)["rspec"] = 1
Util.expects(:make_subscription).never
@client.subscribe("rspec", :queue)
client.subscribe("rspec", :queue)
end
end
describe "#unsubscribe" do
it "should unsubscribe if a subscription has been made" do
subscription = mock
@client.instance_variable_get(:@subscriptions)["rspec"] = 1
client.instance_variable_get(:@subscriptions)["rspec"] = 1
Util.expects(:make_subscriptions).returns(subscription)
Util.expects(:unsubscribe).with(subscription)
@client.unsubscribe("rspec", :queue)
client.unsubscribe("rspec", :queue)
end
it "should no unsubscribe if a subscription hasn't been made" do
Util.expects(:make_subscription).never
@client.unsubscribe("rspec", :queue)
client.unsubscribe("rspec", :queue)
end
end
describe "receive" do
let(:message) do
m = mock
m = mock('message')
m.stubs(:type=)
m.stubs(:expected_msgid=)
m.stubs(:decode!)
m.stubs(:requestid).returns("erfs123")
m.stubs(:payload).returns({:senderid => 'test-sender'})
m
end
let(:badmessage) do
m = mock
m = mock('badmessage')
m.stubs(:type=)
m.stubs(:expected_msgid=)
m.stubs(:decode!)
m.stubs(:requestid).returns("badmessage")
m.stubs(:payload).returns({})
m
end
it "should receive a message" do
@connector.stubs(:receive).returns(message)
result = @client.receive("erfs123")
result = client.receive("erfs123")
result.should == message
end
it "log and retry if the message reqid does not match the expected msgid" do
it 'should log who the message was from' do
@connector.stubs(:receive).returns(message)
Log.expects(:debug).with("Received reply to erfs123 from test-sender")
client.receive("erfs123")
end
it "should log and retry if the message reqid does not match the expected msgid" do
Log.stubs(:debug)
Log.expects(:debug).with("Ignoring a message for some other client : Message reqid badmessage does not match our reqid erfs123")
@connector.stubs(:receive).returns(badmessage, message)
@client.receive("erfs123")
client.receive("erfs123")
end
it "should log and retry if a SecurityValidationFailed expection is raised" do
Log.expects(:warn).with("Ignoring a message that did not pass security validations")
badmessage.stubs(:decode!).raises(SecurityValidationFailed)
@connector.stubs(:receive).returns(badmessage, message)
@client.receive("erfs123")
client.receive("erfs123")
end
end
describe "#discover" do
it "should delegate to the discovery plugins" do
@discoverer.expects(:discover).with({}, 1, 0).returns([])
@client.discover({}, 1).should == []
@discoverer.expects(:discover).with({'collective' => 'mcollective'}, 1, 0).returns([])
client.discover({}, 1).should == []
end
end
@@ -171,33 +197,33 @@ module MCollective
end
before :each do
@client.expects(:unsubscribe)
client.expects(:unsubscribe)
@discoverer.expects(:discovery_timeout).with(message.options[:timeout], message.options[:filter]).returns(0)
@client.stubs(:createreq).returns(request)
@client.expects(:update_stat)
client.stubs(:createreq).returns(request)
client.expects(:update_stat)
end
it "should thread the publisher and receiver if configured" do
@client.instance_variable_get(:@options)[:threaded] = true
@client.expects(:threaded_req).with(request, nil, 0, 1)
client.instance_variable_get(:@options)[:threaded] = true
client.expects(:threaded_req).with(request, nil, 0, 1)
message.options[:threaded] = true
@client.req(message)
client.req(message)
end
it "should not thread the publisher and receiver if configured" do
@client.instance_variable_set(:@threaded, false)
@client.expects(:unthreaded_req).with(request, nil, 0, 1)
@client.req(message)
client.instance_variable_set(:@threaded, false)
client.expects(:unthreaded_req).with(request, nil, 0, 1)
client.req(message)
end
end
describe "#unthreaded_req" do
it "should start a publisher and then start a receiver" do
request = mock
request.stubs(:requestid).returns("erfs123")
@client.expects(:start_publisher).with(request, 5)
@client.expects(:start_receiver).with("erfs123", 2, 10)
@client.unthreaded_req(request, 5, 10, 2)
client.expects(:start_publisher).with(request, 5)
client.expects(:start_receiver).with("erfs123", 2, 10)
client.unthreaded_req(request, 5, 10, 2)
end
end
@@ -209,10 +235,10 @@ module MCollective
r_thread = mock
Thread.expects(:new).yields.returns(p_thread)
Thread.expects(:new).yields.returns(r_thread)
@client.expects(:start_publisher).with(request, 5)
@client.expects(:start_receiver).with("erfs123", 2, 15).returns(2)
client.expects(:start_publisher).with(request, 5)
client.expects(:start_receiver).with("erfs123", 2, 15).returns(2)
p_thread.expects(:join)
result = @client.threaded_req(request, 5, 10, 2)
result = client.threaded_req(request, 5, 10, 2)
result.should == 2
end
end
@@ -230,13 +256,13 @@ module MCollective
it "should publish the message" do
Timeout.stubs(:timeout).with(2).yields
message.expects(:publish)
@client.start_publisher(message, 2)
client.start_publisher(message, 2)
end
it "should log a warning on a timeout" do
Timeout.stubs(:timeout).raises(Timeout::Error)
Timeout.stubs(:timeout).with(2).raises(Timeout::Error)
Log.expects(:warn).with("Could not publish all messages. Publishing timed out.")
@client.start_publisher(message,2)
client.start_publisher(message,2)
end
end
@@ -245,9 +271,9 @@ module MCollective
results = []
Timeout.stubs(:timeout).yields
message = mock
@client.stubs(:receive).with("erfs123").returns(message)
client.stubs(:receive).with("erfs123").returns(message)
message.stubs(:payload).returns("msg1", "msg2", "msg3")
@client.start_receiver("erfs123", 3, 5) do |msg|
client.start_receiver("erfs123", 3, 5) do |msg|
results << msg
end
results.should == ["msg1", "msg2", "msg3"]
@@ -257,10 +283,10 @@ module MCollective
results = []
Timeout.stubs(:timeout).yields
message = mock
@client.stubs(:receive).with("erfs123").returns(message)
client.stubs(:receive).with("erfs123").returns(message)
message.stubs(:payload).returns("msg1", "msg2", "timeout")
Log.expects(:warn).with("Could not receive all responses. Expected : 3. Received : 2")
responded = @client.start_receiver("erfs123", 3, 5) do |msg|
responded = client.start_receiver("erfs123", 3, 5) do |msg|
if msg == "timeout"
raise Timeout::Error
end
@@ -274,10 +300,10 @@ module MCollective
results = []
Timeout.stubs(:timeout).yields
message = mock
@client.stubs(:receive).with("erfs123").returns(message)
client.stubs(:receive).with("erfs123").returns(message)
message.stubs(:payload).returns("msg1", "msg2", "timeout")
Log.expects(:warn).never
responded = @client.start_receiver("erfs123", 2, 5) do |msg|
responded = client.start_receiver("erfs123", 2, 5) do |msg|
if msg == "timeout"
raise Timeout::Error
end
@@ -291,7 +317,7 @@ module MCollective
describe "#update_stat" do
let(:before) do
{ :starttime => Time.now.to_f,
:discoverytime => 0,
:discoverytime => 0,
:blocktime => 0,
:totaltime => 0 }
end
@@ -308,14 +334,14 @@ module MCollective
it "should update stats and return the stats hash" do
Time.stubs(:now).returns(10, 20)
@client.update_stat(before, 5, "erfs123").should == after
client.update_stat(before, 5, "erfs123").should == after
end
end
describe "#discovered_req" do
it "should raise a deprecation exception" do
expect{
@client.discovered_req(nil, nil)
client.discovered_req(nil, nil)
}.to raise_error("Client#discovered_req has been removed, please port your agent and client to the SimpleRPC framework")
end
end
View
@@ -300,6 +300,36 @@ module MCollective
m.decode!
}.to raise_error('callerid in request is not valid, surpressing reply to potentially forged request')
end
it 'should handle the securityprovider failing to decodemsg - log for reply' do
security = mock('securityprovider')
security.expects(:decodemsg).raises('squirrel attack')
PluginManager.expects("[]").with("security_plugin").returns(security).once
m = Message.new("payload", "message", :type => :reply)
m.stubs(:headers).returns({'mc_sender' => 'trees'})
Log.expects(:warn).with("Failed to decode a message from 'trees': squirrel attack")
expect {
m.decode!
}.to_not raise_error
end
it 'should handle the securityprovider failing to decodemsg' do
security = mock('securityprovider')
security.expects(:decodemsg).raises('squirrel attack')
PluginManager.expects("[]").with("security_plugin").returns(security).once
m = Message.new("payload", "message", :type => :request)
Log.expects(:warn).never
expect {
m.decode!
}.to raise_error(/squirrel attack/)
end
end
describe "#validate_compound_filter" do
View
@@ -197,6 +197,12 @@ module MCollective
@parser.instance_variable_get(:@options)[:discovery_options].should == ['nodes.txt']
end
it 'should parse the --nodes option' do
ARGV << '--connection-timeout=1'
@parser.parse
@parser.instance_variable_get(:@options)[:connection_timeout].should == 1
end
it 'should fail on the --nodes option if discovery_method or discovery_options have already been set' do
end
Oops, something went wrong.