Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests for the new rpcutil agent

  • Loading branch information...
commit e59112882dae766a8b6d788473e1ab61ffefad65 1 parent a3be7fe
@ripienaar authored
View
11 features/rpcutil_agent_inventory.feature
@@ -0,0 +1,11 @@
+Feature: Test the rpcutil agent
+
+ Background:
+ Given I want to use the config file support/client.cfg
+ And I want to test the rpcutil agent
+
+ Scenario: Test the agent_inventory action of the rpcutil agent
+ When I invoke the agent_inventory action
+ Then the result should not be an error
+ And the following parameters should be received as a result:
+ | agents | should be present |
View
21 features/rpcutil_daemon_stats.feature
@@ -0,0 +1,21 @@
+Feature: Test the rpcutil agent
+
+ Background:
+ Given I want to use the config file support/client.cfg
+ And I want to test the rpcutil agent
+
+ Scenario: Test the daemon_stats action of the rpcutil agent
+ When I invoke the daemon_stats action
+ Then the result should not be an error
+ And the following parameters should be received as a result:
+ | threads | should be present |
+ | agents | should be present |
+ | pid | should be present |
+ | times | should be present |
+ | validated | should be present |
+ | unvalidated | should be present |
+ | passed | should be present |
+ | filtered | should be present |
+ | starttime | should be present |
+ | total | should be present |
+ | replies | should be present |
View
16 features/rpcutil_get_fact.feature
@@ -0,0 +1,16 @@
+Feature: Test the rpcutil agent
+
+ Background:
+ Given I want to use the config file support/client.cfg
+ And I want to test the rpcutil agent
+
+ Scenario: Test the get_fact action of the rpcutil agent
+ Given the following request parameters:
+ | fact | mcollective |
+
+ When I invoke the get_fact action
+ Then the result should not be an error
+ And the following parameters should be received as a result:
+ | fact | mcollective |
+ | value | 1 |
+
View
13 features/rpcutil_inventory.feature
@@ -0,0 +1,13 @@
+Feature: Test the rpcutil agent
+
+ Background:
+ Given I want to use the config file support/client.cfg
+ And I want to test the rpcutil agent
+
+ Scenario: Test the inventory action of the rpcutil agent
+ When I invoke the inventory action
+ Then the result should not be an error
+ And the following parameters should be received as a result:
+ | agents | should be present |
+ | facts | should be present |
+ | classes | should be present |
View
19 features/step_definitions/invocation_and_result_steps.rb
@@ -23,12 +23,21 @@
raise "Reply does not have #{key}" unless data.keys.include?(key)
- if val =~ /^\/(.+)\/$/
- regex = Regexp.new($1)
+ if val == "should be present"
+ raise "Received data does not include #{key}" unless data.include?(key)
else
- regex = Regexp.new("^#{val}$")
+ if data[key].is_a?(String)
+ if val =~ /^\/(.+)\/$/
+ regex = Regexp.new($1)
+ else
+ regex = Regexp.new("^#{val}$")
+ end
+
+ raise "#{data[key]} does not match regex #{regex}" unless data[key].match(regex)
+
+ elsif data[key].is_a?(Fixnum)
+ raise "#{data[key]} does not match Fixnum #{val.to_i}" unless val.to_i == data[key]
+ end
end
-
- raise "#{data[key]} does not match regex #{regex}" unless data[key].match(regex)
end
end
View
2  features/support/env.rb
@@ -5,5 +5,7 @@
Before do
@options = rpcoptions do |parser, options|
end
+
+ @request = {:options => @options}
end
Please sign in to comment.
Something went wrong with that request. Please try again.