mcollective-test 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ module MCollective
2
2
  module Test
3
3
  autoload :Util, "mcollective/test/util"
4
4
  autoload :Matchers, "mcollective/test/matchers"
5
+ autoload :DataTest, "mcollective/test/data_test.rb"
5
6
  autoload :LocalAgentTest, "mcollective/test/local_agent_test.rb"
6
7
  autoload :RemoteAgentTest, "mcollective/test/remote_agent_test.rb"
7
8
  autoload :ApplicationTest, "mcollective/test/application_test.rb"
@@ -0,0 +1,44 @@
1
+ module MCollective
2
+ module Test
3
+ class DataTest
4
+ attr_reader :config, :logger, :plugin
5
+
6
+ include Test::Util
7
+
8
+ def initialize(data, options={})
9
+ config = options.fetch(:config, {})
10
+
11
+ ARGV.clear
12
+
13
+ @config = create_config_mock(config)
14
+ @logger = create_logger_mock
15
+
16
+ @plugin = load_data(data, options[:data_file])
17
+ @plugin.stubs(:ddl_validate).returns(true)
18
+ end
19
+
20
+ def load_data(data, data_file=nil)
21
+ classname = "MCollective::Data::%s " % data.capitalize
22
+
23
+ PluginManager.delete(data.downcase)
24
+
25
+ if data_file
26
+ raise("Cannot find data file %s for data plugin %s" % [data_file, data]) unless File.exist?(data_file)
27
+ load data_file
28
+ else
29
+ PluginManager.loadclass(classname)
30
+ end
31
+
32
+ ddl = DDL::Base.new(data, :data, false)
33
+
34
+ DDL.stubs(:new).with(data, :data).returns(ddl)
35
+
36
+ unless PluginManager.pluginlist.include?(data.downcase)
37
+ PluginManager << {:type => data, :class => "MCollective::Data::%s" % data.capitalize, :single_instance => false}
38
+ end
39
+
40
+ PluginManager[data.downcase]
41
+ end
42
+ end
43
+ end
44
+ end
@@ -15,7 +15,12 @@ module MCollective
15
15
  end
16
16
 
17
17
  [actual].flatten.each do |result|
18
- result = result.results if result.is_a?(MCollective::RPC::Result)
18
+ if result.is_a?(MCollective::RPC::Result)
19
+ result = result.results
20
+ elsif result.is_a?(MCollective::Data::Result)
21
+ result = {:data => result.instance_variable_get("@data")}
22
+ end
23
+
19
24
  @nodeid = result[:data][:test_sender]
20
25
  @actual << result
21
26
  @expected.each do |e|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcollective-test
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-17 00:00:00 +01:00
18
+ date: 2013-01-07 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -32,6 +32,7 @@ files:
32
32
  - lib/mcollective/test/local_agent_test.rb
33
33
  - lib/mcollective/test/matchers.rb
34
34
  - lib/mcollective/test/remote_agent_test.rb
35
+ - lib/mcollective/test/data_test.rb
35
36
  - lib/mcollective/test/matchers/rpc_metadata.rb
36
37
  - lib/mcollective/test/matchers/rpc_result_items.rb
37
38
  - lib/mcollective/test/matchers/rpc_status.rb