cucumber-nagios 0.5.1 → 0.6.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.
@@ -6,4 +6,5 @@ gem "rspec", "1.2.9"
6
6
  gem "webrat", "0.5.3"
7
7
  gem "mechanize", "0.9.3"
8
8
  gem "templater", "0.5.0"
9
+ gem "net-ssh", "2.0.15"
9
10
 
@@ -0,0 +1,77 @@
1
+ Given /^I have no public keys set$/ do
2
+ @auth_methods = %w(password)
3
+ end
4
+
5
+ Then /^I can ssh to "([^\"]*)" with the following credentials:$/ do |host, table|
6
+ @auth_methods ||= %w(publickey password)
7
+
8
+ credentials = table.hashes
9
+ credentials.each do |creds|
10
+ lambda {
11
+ Net::SSH.start(host, creds["username"], :password => creds["password"], :auth_methods => @auth_methods)
12
+ }.should_not raise_error(Net::SSH::AuthenticationFailed)
13
+ end
14
+ end
15
+
16
+ Then /^I can ssh to the following hosts with these credentials:$/ do |table|
17
+ @keys ||= []
18
+ @auth_methods ||= %w(password)
19
+ session_details = table.hashes
20
+
21
+ session_details.each do |session|
22
+ # initialize a list of keys and auth methods for just this session, as
23
+ # session can have session-specific keys mixed with global keys
24
+ session_keys = Array.new(@keys)
25
+ session_auth_methods = Array.new(@auth_methods)
26
+
27
+ # you can pass in a keyfile in the session details, so we need to
28
+ if session["keyfile"]
29
+ session_keys << session["keyfile"]
30
+ session_auth_methods << "publickey"
31
+ end
32
+
33
+ lambda {
34
+ Net::SSH.start(session["hostname"], session["username"], :password => session["password"],
35
+ :auth_methods => session_auth_methods,
36
+ :keys => session_keys)
37
+ }.should_not raise_error(Net::SSH::AuthenticationFailed)
38
+ end
39
+ end
40
+
41
+ Given /^I have the following public keys:$/ do |table|
42
+ @keys = []
43
+ public_key_paths = table.hashes
44
+
45
+ public_key_paths.each do |key|
46
+ File.exist?(key["keyfile"]).should be_true
47
+ @keys << key["keyfile"]
48
+ end
49
+
50
+ @auth_methods ||= %w(password)
51
+ @auth_methods << "publickey"
52
+ end
53
+
54
+ When /^I ssh to "([^\"]*)" with the following credentials:$/ do |hostname, table|
55
+ session = table.hashes.first
56
+ session_keys = Array.new(@keys)
57
+ session_auth_methods = Array.new(@auth_methods)
58
+ if session["keyfile"]
59
+ session_keys << session["keyfile"]
60
+ session_auth_methods << "publickey"
61
+ end
62
+
63
+ lambda {
64
+ @connection = Net::SSH.start(hostname, session["username"], :password => session["password"],
65
+ :auth_methods => session_auth_methods,
66
+ :keys => session_keys)
67
+ }.should_not raise_error
68
+ end
69
+
70
+ When /^I run "([^\"]*)"$/ do |command|
71
+ @output = @connection.exec!(command)
72
+ end
73
+
74
+ Then /^I should see "([^\"]*)" in the output$/ do |string|
75
+ @output.should =~ /#{string}/
76
+ end
77
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindsay Holmwood
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-30 00:00:00 +01:00
12
+ date: 2009-11-09 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.6.0
44
44
  version:
45
- description: cucumber-nagios lets you write high-level behavioural tests for your web applications that can be plugged into Nagios
45
+ description: cucumber-nagios lets you write high-level behavioural tests for your web applications and Unix infrastructure that can be plugged into Nagios
46
46
  email: lindsay@holmwood.id.au
47
47
  executables:
48
48
  - cucumber-nagios-gen
@@ -54,6 +54,7 @@ files:
54
54
  - bin/cucumber-nagios-gen
55
55
  - lib/generators/project/Gemfile
56
56
  - lib/generators/project/features/steps/benchmark_steps.rb
57
+ - lib/generators/project/features/steps/ssh_steps.rb
57
58
  - lib/generators/project/features/steps/result_steps.rb
58
59
  - lib/generators/project/features/steps/webrat_steps.rb
59
60
  - lib/generators/project/features/support/env.rb
@@ -102,6 +103,6 @@ rubyforge_project: cucumber-nagios
102
103
  rubygems_version: 1.3.5
103
104
  signing_key:
104
105
  specification_version: 3
105
- summary: web app testing plugin for Nagios using Cucumber/Webrat/Mechanize
106
+ summary: systems testing plugin for Nagios using Cucumber/Webrat/Mechanize/net-ssh
106
107
  test_files: []
107
108