cucumber-nagios 0.8.0 → 0.8.2
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.
- data/.gitignore +21 -0
- data/AUTHORS +1 -0
- data/README.md +44 -45
- data/Rakefile +79 -0
- data/VERSION +1 -0
- data/bin/cucumber-nagios-gen +4 -5
- data/cucumber-nagios.gemspec +113 -0
- data/features/commands.feature +25 -0
- data/features/creating.feature +11 -0
- data/features/files.feature +54 -0
- data/features/http_steps.feature +9 -0
- data/features/installing.feature +11 -0
- data/features/steps/creating_steps.rb +24 -0
- data/features/steps/installing_steps.rb +29 -0
- data/features/steps/using_steps.rb +35 -0
- data/features/support/env.rb +11 -0
- data/features/support/silent_system.rb +4 -0
- data/features/support/webrat_logging_patches.rb +10 -0
- data/features/using.feature +27 -0
- data/lib/cucumber/nagios/steps/http_header_steps.rb +21 -0
- data/lib/cucumber/nagios/support/env.rb +4 -0
- data/lib/generators/project/Gemfile +5 -5
- data/lib/generators/project/README +44 -44
- data/lib/generators/project/bin/cucumber-nagios +13 -20
- data/lib/generators/project/lib/generators/feature/%feature_name%.feature +1 -1
- metadata +92 -57
data/.gitignore
ADDED
data/AUTHORS
CHANGED
|
@@ -13,5 +13,6 @@ Juri Rischel Jensen <juri@fab-it.dk>
|
|
|
13
13
|
Gareth Rushgrove <gareth@morethanseven.net>
|
|
14
14
|
Jesse Newland <jesse@jnewland.com>
|
|
15
15
|
Luiz Ozaki
|
|
16
|
+
Dean Wilson <dean.wilson@gmail.com>
|
|
16
17
|
|
|
17
18
|
Portions of cucumber-nagios contain code originally contributed to Chef (http://github.com/opscode/chef)
|
data/README.md
CHANGED
|
@@ -19,15 +19,25 @@ Quickstart
|
|
|
19
19
|
1. `gem install cucumber-nagios`
|
|
20
20
|
3. `cucumber-nagios-gen project bunch-o-tests`
|
|
21
21
|
4. `cd bunch-o-tests`
|
|
22
|
-
5. `
|
|
22
|
+
5. `bundle install`
|
|
23
23
|
6. `cucumber-nagios-gen feature ebay.com.au bidding`
|
|
24
24
|
7. `bin/cucumber-nagios features/ebay.com.au/bidding.feature`
|
|
25
25
|
|
|
26
|
+
Installing
|
|
27
|
+
==========
|
|
28
|
+
|
|
29
|
+
Install the gem with:
|
|
30
|
+
|
|
31
|
+
gem install cucumber-nagios
|
|
32
|
+
|
|
33
|
+
This will add the `cucumber-nagios-gen` command to your path, and make the
|
|
34
|
+
shipped cucumber-nagios steps available to other projects using Cucumber.
|
|
35
|
+
|
|
26
36
|
|
|
27
37
|
Setting up a project
|
|
28
38
|
====================
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
After installing the cucumer-nagios gem, set up a standalone project with:
|
|
31
41
|
|
|
32
42
|
cucumber-nagios-gen project <project-name>
|
|
33
43
|
|
|
@@ -41,45 +51,27 @@ Bundling dependencies
|
|
|
41
51
|
=====================
|
|
42
52
|
|
|
43
53
|
Bundling cucumber-nagios's dependencies allows you to drop your cucumber-nagios
|
|
44
|
-
project
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
You'll need to bundle your dependencies to use cucumber-nagios.
|
|
54
|
+
project on any machine and have it run. This solves the case of developing your
|
|
55
|
+
checks on your local machine, and deploying them on a production monitoring
|
|
56
|
+
server.
|
|
49
57
|
|
|
50
58
|
First you need to make sure the following dependencies are installed:
|
|
51
59
|
|
|
52
60
|
- RubyGems
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
To bundle your dependencies, within your project directory run:
|
|
56
|
-
|
|
57
|
-
$ gem bundle
|
|
58
|
-
|
|
59
|
-
*Please note*: cucumber-nagios uses `bundler08`, **not** `bundler`. Until the
|
|
60
|
-
`bundler` guys sort their shit out, I refuse to release software that uses it.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Deploying to production
|
|
64
|
-
=======================
|
|
61
|
+
- `bundler` gem (automatically pulled in by the `cucumber-nagios` gem)
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
$ gem bundle
|
|
69
|
-
|
|
70
|
-
You'll need to have RubyGems and the bundler gem installed on the system
|
|
71
|
-
you're deploying too. I know, this is not optimal, but hopefully the bundler
|
|
72
|
-
gem will handle this better in the future.
|
|
63
|
+
Then to bundle your dependencies, within your project directory run:
|
|
73
64
|
|
|
65
|
+
$ bundle install
|
|
74
66
|
|
|
75
67
|
Writing features
|
|
76
68
|
================
|
|
77
69
|
|
|
78
|
-
Once you've set up a project, you can use the `
|
|
70
|
+
Once you've set up a project, you can use the `cucumber-nagios-gen` command
|
|
79
71
|
to generate new features. It takes two arguments: the site you're testing, and
|
|
80
72
|
feature you're testing:
|
|
81
73
|
|
|
82
|
-
|
|
74
|
+
cucumber-nagios-gen feature gnome.org navigation
|
|
83
75
|
|
|
84
76
|
This will spit out two files:
|
|
85
77
|
|
|
@@ -117,7 +109,7 @@ in `features/smh.com.au/smh.feature`:
|
|
|
117
109
|
Then I should see site navigation
|
|
118
110
|
And there should be a section named "Opinion"
|
|
119
111
|
|
|
120
|
-
There aren't steps for
|
|
112
|
+
There aren't steps for `Then I should see site navigation`, so you have to
|
|
121
113
|
write one yourself. :-) In `features/smh.com.au/steps/smh_steps.rb`:
|
|
122
114
|
|
|
123
115
|
Then /^I should see site navigation$/ do
|
|
@@ -206,6 +198,16 @@ You can test for various conditions on an AMQP message queue.
|
|
|
206
198
|
This has been tested using RabbitMQ but uses the amqp gem which should support
|
|
207
199
|
other backends. See features/amqp_steps.rb for all the available steps.
|
|
208
200
|
|
|
201
|
+
Deploying to production
|
|
202
|
+
=======================
|
|
203
|
+
|
|
204
|
+
As per the install instructions above, make sure you have RubyGems and the `bundler`
|
|
205
|
+
gem installed.
|
|
206
|
+
|
|
207
|
+
Once you've copied your project to your monitoring server, just run bundler again:
|
|
208
|
+
|
|
209
|
+
$ bundle install
|
|
210
|
+
|
|
209
211
|
Quirks
|
|
210
212
|
======
|
|
211
213
|
|
|
@@ -222,25 +224,28 @@ test failure.
|
|
|
222
224
|
Using the Steps in another Cucumber suite
|
|
223
225
|
=========================================
|
|
224
226
|
|
|
225
|
-
If you want to use the steps
|
|
226
|
-
require the
|
|
227
|
+
If you want to use the steps shipped with cucumber-nagios elsewhere, you can
|
|
228
|
+
require them by adding the following line to `features/support/env.rb` like so:
|
|
227
229
|
|
|
228
|
-
# All
|
|
229
230
|
require 'cucumber/nagios/steps'
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
Or just require the steps you care about:
|
|
233
|
+
|
|
232
234
|
require 'cucumber/nagios/steps/ssh'
|
|
233
235
|
require 'cucumber/nagios/steps/ping'
|
|
234
236
|
|
|
235
237
|
Using the Formatter in another Cucumber suite
|
|
236
238
|
=============================================
|
|
237
239
|
|
|
240
|
+
Once installed as a gem, the `cucumber-nagios` formatter is available in any
|
|
241
|
+
other Cucumber test suite:
|
|
242
|
+
|
|
238
243
|
cucumber --format Cucumber::Formatter::Nagios features/foo.feature
|
|
239
244
|
|
|
240
245
|
Version control
|
|
241
246
|
===============
|
|
242
247
|
|
|
243
|
-
It's
|
|
248
|
+
It's _strongly_ recommend that you store your cucumber-nagios projects in a version
|
|
244
249
|
control system!
|
|
245
250
|
|
|
246
251
|
To get up and running with git:
|
|
@@ -249,21 +254,15 @@ To get up and running with git:
|
|
|
249
254
|
$ git add .
|
|
250
255
|
$ git commit -m 'created cucumber-nagios project'
|
|
251
256
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
$ bzr init
|
|
255
|
-
$ bzr add
|
|
256
|
-
$ bzr commit -m 'created cucumber-nagios project'
|
|
257
|
-
|
|
258
|
-
`.bzrignore` and `.gitignores` are created when you generate a project.
|
|
257
|
+
`.gitignore` is created when you generate a project.
|
|
259
258
|
|
|
260
259
|
Testing
|
|
261
|
-
|
|
260
|
+
=======
|
|
262
261
|
|
|
263
262
|
The gem is thoroughly tested (with Cucumber, no less). The gem's Cucumber
|
|
264
263
|
features live in $gemroot/features/, and can be run with:
|
|
265
264
|
|
|
266
|
-
$ cucumber
|
|
267
|
-
$ cucumber
|
|
268
|
-
$ cucumber
|
|
265
|
+
$ cucumber features/installing.feature
|
|
266
|
+
$ cucumber features/creating.feature
|
|
267
|
+
$ cucumber features/using.feature
|
|
269
268
|
|
data/Rakefile
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'rake'
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
require 'jeweler'
|
|
8
|
+
Jeweler::Tasks.new do |gem|
|
|
9
|
+
gem.name = "cucumber-nagios"
|
|
10
|
+
gem.summary = "Systems testing plugin for Nagios using Cucumber/Webrat/Mechanize/net-ssh."
|
|
11
|
+
gem.description = "cucumber-nagios helps you write high-level behavioural tests for your web applications and Unix infrastructure that can be plugged into Nagios."
|
|
12
|
+
gem.email = "lindsay@holmwood.id.au"
|
|
13
|
+
gem.homepage = "http://cucumber-nagios.org/"
|
|
14
|
+
gem.authors = ["Lindsay Holmwood"]
|
|
15
|
+
gem.has_rdoc = false
|
|
16
|
+
|
|
17
|
+
gem.add_dependency('cucumber', '>= 0.10.0')
|
|
18
|
+
gem.add_dependency('rspec', '>= 2.3.0')
|
|
19
|
+
gem.add_dependency('webrat', '= 0.7.2')
|
|
20
|
+
gem.add_dependency('mechanize', '= 1.0.0')
|
|
21
|
+
gem.add_dependency('templater', '>= 1.0.0')
|
|
22
|
+
gem.add_dependency('net-ssh', '= 2.0.18')
|
|
23
|
+
gem.add_dependency('amqp', '= 0.6.7')
|
|
24
|
+
gem.add_dependency('bundler', '= 1.0.7')
|
|
25
|
+
|
|
26
|
+
gem.add_development_dependency('rake', '>= 0.8.3')
|
|
27
|
+
|
|
28
|
+
gem.bindir = "bin"
|
|
29
|
+
gem.executables = %w(cucumber-nagios-gen)
|
|
30
|
+
end
|
|
31
|
+
Jeweler::GemcutterTasks.new
|
|
32
|
+
rescue LoadError
|
|
33
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
require 'rake/testtask'
|
|
37
|
+
Rake::TestTask.new(:test) do |test|
|
|
38
|
+
test.libs << 'lib' << 'test'
|
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
|
40
|
+
test.verbose = true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
begin
|
|
44
|
+
require 'rcov/rcovtask'
|
|
45
|
+
Rcov::RcovTask.new do |test|
|
|
46
|
+
test.libs << 'test'
|
|
47
|
+
test.pattern = 'test/**/test_*.rb'
|
|
48
|
+
test.verbose = true
|
|
49
|
+
end
|
|
50
|
+
rescue LoadError
|
|
51
|
+
task :rcov do
|
|
52
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
task :test => :check_dependencies
|
|
57
|
+
|
|
58
|
+
begin
|
|
59
|
+
require 'cucumber/rake/task'
|
|
60
|
+
Cucumber::Rake::Task.new(:features)
|
|
61
|
+
|
|
62
|
+
task :features => :check_dependencies
|
|
63
|
+
rescue LoadError
|
|
64
|
+
task :features do
|
|
65
|
+
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
task :default => :test
|
|
70
|
+
|
|
71
|
+
require 'rake/rdoctask'
|
|
72
|
+
Rake::RDocTask.new do |rdoc|
|
|
73
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
74
|
+
|
|
75
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
76
|
+
rdoc.title = "cucumber-nagios #{version}"
|
|
77
|
+
rdoc.rdoc_files.include('README*')
|
|
78
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
79
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.2
|
data/bin/cucumber-nagios-gen
CHANGED
|
@@ -38,12 +38,11 @@ Your new cucumber-nagios project has been generated.
|
|
|
38
38
|
|
|
39
39
|
To get going, you'll need to bundle gems into the project:
|
|
40
40
|
|
|
41
|
-
$
|
|
41
|
+
$ bundle install
|
|
42
42
|
|
|
43
|
-
It's *highly* recommended you version control your project
|
|
43
|
+
It's *highly* recommended you version control your project
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
- with Bazaar: bzr init ; bzr add
|
|
45
|
+
$ git init ; git add .
|
|
47
46
|
|
|
48
47
|
README
|
|
49
48
|
end
|
|
@@ -62,7 +61,7 @@ It's *highly* recommended you version control your project:
|
|
|
62
61
|
|
|
63
62
|
desc <<-DESC
|
|
64
63
|
Generate a cucumber feature. Takes a two arguments:
|
|
65
|
-
|
|
64
|
+
cucumber-nagios-gen feature <site-name> <feature-name>
|
|
66
65
|
DESC
|
|
67
66
|
|
|
68
67
|
first_argument :site, :required => true, :desc => "Site name"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{cucumber-nagios}
|
|
8
|
+
s.version = "0.8.2"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Lindsay Holmwood"]
|
|
12
|
+
s.date = %q{2010-12-30}
|
|
13
|
+
s.default_executable = %q{cucumber-nagios-gen}
|
|
14
|
+
s.description = %q{cucumber-nagios helps you write high-level behavioural tests for your web applications and Unix infrastructure that can be plugged into Nagios.}
|
|
15
|
+
s.email = %q{lindsay@holmwood.id.au}
|
|
16
|
+
s.executables = ["cucumber-nagios-gen"]
|
|
17
|
+
s.extra_rdoc_files = [
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"README.md",
|
|
20
|
+
"TODO"
|
|
21
|
+
]
|
|
22
|
+
s.files = [
|
|
23
|
+
".gitignore",
|
|
24
|
+
"AUTHORS",
|
|
25
|
+
"HACKING",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md",
|
|
28
|
+
"Rakefile",
|
|
29
|
+
"TODO",
|
|
30
|
+
"VERSION",
|
|
31
|
+
"bin/cucumber-nagios-gen",
|
|
32
|
+
"cucumber-nagios.gemspec",
|
|
33
|
+
"features/commands.feature",
|
|
34
|
+
"features/creating.feature",
|
|
35
|
+
"features/files.feature",
|
|
36
|
+
"features/http_steps.feature",
|
|
37
|
+
"features/installing.feature",
|
|
38
|
+
"features/steps/creating_steps.rb",
|
|
39
|
+
"features/steps/installing_steps.rb",
|
|
40
|
+
"features/steps/using_steps.rb",
|
|
41
|
+
"features/support/env.rb",
|
|
42
|
+
"features/support/silent_system.rb",
|
|
43
|
+
"features/support/webrat_logging_patches.rb",
|
|
44
|
+
"features/using.feature",
|
|
45
|
+
"lib/cucumber-nagios.rb",
|
|
46
|
+
"lib/cucumber/formatter/nagios.rb",
|
|
47
|
+
"lib/cucumber/nagios.rb",
|
|
48
|
+
"lib/cucumber/nagios/command.rb",
|
|
49
|
+
"lib/cucumber/nagios/steps.rb",
|
|
50
|
+
"lib/cucumber/nagios/steps/amqp_steps.rb",
|
|
51
|
+
"lib/cucumber/nagios/steps/benchmark_steps.rb",
|
|
52
|
+
"lib/cucumber/nagios/steps/command_steps.rb",
|
|
53
|
+
"lib/cucumber/nagios/steps/dns_steps.rb",
|
|
54
|
+
"lib/cucumber/nagios/steps/file_steps.rb",
|
|
55
|
+
"lib/cucumber/nagios/steps/http_header_steps.rb",
|
|
56
|
+
"lib/cucumber/nagios/steps/http_steps.rb",
|
|
57
|
+
"lib/cucumber/nagios/steps/ping_steps.rb",
|
|
58
|
+
"lib/cucumber/nagios/steps/ssh_steps.rb",
|
|
59
|
+
"lib/cucumber/nagios/support/env.rb",
|
|
60
|
+
"lib/cucumber/nagios/support/webrat_logging_patches.rb",
|
|
61
|
+
"lib/cucumber/nagios/version.rb",
|
|
62
|
+
"lib/generators/project/.bzrignore",
|
|
63
|
+
"lib/generators/project/.gitignore",
|
|
64
|
+
"lib/generators/project/Gemfile",
|
|
65
|
+
"lib/generators/project/README",
|
|
66
|
+
"lib/generators/project/bin/cucumber-nagios",
|
|
67
|
+
"lib/generators/project/lib/generators/feature/%feature_name%.feature",
|
|
68
|
+
"lib/generators/project/lib/generators/feature/%feature_name%_steps.rb"
|
|
69
|
+
]
|
|
70
|
+
s.homepage = %q{http://cucumber-nagios.org/}
|
|
71
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
72
|
+
s.require_paths = ["lib"]
|
|
73
|
+
s.rubygems_version = %q{1.3.7}
|
|
74
|
+
s.summary = %q{Systems testing plugin for Nagios using Cucumber/Webrat/Mechanize/net-ssh.}
|
|
75
|
+
|
|
76
|
+
if s.respond_to? :specification_version then
|
|
77
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
78
|
+
s.specification_version = 3
|
|
79
|
+
|
|
80
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
81
|
+
s.add_runtime_dependency(%q<cucumber>, [">= 0.10.0"])
|
|
82
|
+
s.add_runtime_dependency(%q<rspec>, [">= 2.3.0"])
|
|
83
|
+
s.add_runtime_dependency(%q<webrat>, ["= 0.7.2"])
|
|
84
|
+
s.add_runtime_dependency(%q<mechanize>, ["= 1.0.0"])
|
|
85
|
+
s.add_runtime_dependency(%q<templater>, [">= 1.0.0"])
|
|
86
|
+
s.add_runtime_dependency(%q<net-ssh>, ["= 2.0.18"])
|
|
87
|
+
s.add_runtime_dependency(%q<amqp>, ["= 0.6.7"])
|
|
88
|
+
s.add_runtime_dependency(%q<bundler>, ["= 1.0.7"])
|
|
89
|
+
s.add_development_dependency(%q<rake>, [">= 0.8.3"])
|
|
90
|
+
else
|
|
91
|
+
s.add_dependency(%q<cucumber>, [">= 0.10.0"])
|
|
92
|
+
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
|
93
|
+
s.add_dependency(%q<webrat>, ["= 0.7.2"])
|
|
94
|
+
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
|
95
|
+
s.add_dependency(%q<templater>, [">= 1.0.0"])
|
|
96
|
+
s.add_dependency(%q<net-ssh>, ["= 2.0.18"])
|
|
97
|
+
s.add_dependency(%q<amqp>, ["= 0.6.7"])
|
|
98
|
+
s.add_dependency(%q<bundler>, ["= 1.0.7"])
|
|
99
|
+
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
|
100
|
+
end
|
|
101
|
+
else
|
|
102
|
+
s.add_dependency(%q<cucumber>, [">= 0.10.0"])
|
|
103
|
+
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
|
104
|
+
s.add_dependency(%q<webrat>, ["= 0.7.2"])
|
|
105
|
+
s.add_dependency(%q<mechanize>, ["= 1.0.0"])
|
|
106
|
+
s.add_dependency(%q<templater>, [">= 1.0.0"])
|
|
107
|
+
s.add_dependency(%q<net-ssh>, ["= 2.0.18"])
|
|
108
|
+
s.add_dependency(%q<amqp>, ["= 0.6.7"])
|
|
109
|
+
s.add_dependency(%q<bundler>, ["= 1.0.7"])
|
|
110
|
+
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: Executing commands
|
|
2
|
+
In order to test a running system
|
|
3
|
+
As an administrator
|
|
4
|
+
I want to run arbitrary commands and test the output
|
|
5
|
+
|
|
6
|
+
Scenario: Check Stdout
|
|
7
|
+
When I run 'echo "i like cheese"'
|
|
8
|
+
Then 'stdout' should have 'i like cheese'
|
|
9
|
+
|
|
10
|
+
Scenario: Check Stderr
|
|
11
|
+
When I run 'echo "i like cheese" 1>&2'
|
|
12
|
+
Then 'stderr' should have 'i like cheese'
|
|
13
|
+
|
|
14
|
+
Scenario: Check Stdout for multiple lines
|
|
15
|
+
When I run 'shopt -s xpg_echo ; echo "one\n\one\none\n"'
|
|
16
|
+
Then 'one' should appear on 'stdout' '3' times
|
|
17
|
+
|
|
18
|
+
Scenario: Check exit code
|
|
19
|
+
When I run 'true'
|
|
20
|
+
Then it should exit '0'
|
|
21
|
+
|
|
22
|
+
Scenario: Check exit code
|
|
23
|
+
When I run 'false'
|
|
24
|
+
Then it should exit '1'
|
|
25
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Creating new project
|
|
2
|
+
To test websites
|
|
3
|
+
A cucumber-nagios project
|
|
4
|
+
Must be created
|
|
5
|
+
|
|
6
|
+
Scenario: Create a project
|
|
7
|
+
Given cucumber-nagios is installed
|
|
8
|
+
When I create a new project called "great-website-tests"
|
|
9
|
+
And I freeze in dependencies
|
|
10
|
+
Then a Gemfile lock should be created
|
|
11
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Feature: Examining files
|
|
2
|
+
In order to test a running system
|
|
3
|
+
As an administrator
|
|
4
|
+
I want to examine files
|
|
5
|
+
|
|
6
|
+
Scenario: File exists
|
|
7
|
+
Given we have an empty file named '/tmp/foo.file'
|
|
8
|
+
Then a file named '/tmp/foo.file' should exist
|
|
9
|
+
|
|
10
|
+
Scenario: File does not exist
|
|
11
|
+
Then a file named '/tmp/foo.filepants' should not exist
|
|
12
|
+
|
|
13
|
+
Scenario: Atime
|
|
14
|
+
Given we have an empty file named '/tmp/foo.file'
|
|
15
|
+
And we have the atime/mtime of '/tmp/foo.file'
|
|
16
|
+
And I run 'sleep 1'
|
|
17
|
+
And I run 'touch -a /tmp/foo.file'
|
|
18
|
+
Then the atime of '/tmp/foo.file' should be different
|
|
19
|
+
|
|
20
|
+
Scenario: Mtime
|
|
21
|
+
Given we have an empty file named '/tmp/foo.file'
|
|
22
|
+
And we have the atime/mtime of '/tmp/foo.file'
|
|
23
|
+
And I run 'sleep 1'
|
|
24
|
+
And I run 'touch -m /tmp/foo.file'
|
|
25
|
+
Then the mtime of '/tmp/foo.file' should be different
|
|
26
|
+
|
|
27
|
+
Scenario: File contents
|
|
28
|
+
When I run 'shopt -s xpg_echo ; echo "monkeypants\nmonkeyshorts" > /tmp/monkeytest.file'
|
|
29
|
+
Then a file named '/tmp/monkeytest.file' should contain 'monkeypants'
|
|
30
|
+
|
|
31
|
+
Scenario: File contents multiple times
|
|
32
|
+
When I run 'shopt -s xpg_echo ; echo "monkeypants\nmonkeyshorts" > /tmp/monkeytest.file'
|
|
33
|
+
Then a file named '/tmp/monkeytest.file' should contain 'monkey.+' only '2' times
|
|
34
|
+
|
|
35
|
+
Scenario: File modes
|
|
36
|
+
When I run 'touch /tmp/filemode.file'
|
|
37
|
+
And I run 'chmod 644 /tmp/filemode.file'
|
|
38
|
+
Then the file named '/tmp/filemode.file' should have mode '644'
|
|
39
|
+
And the file named '/tmp/filemode.file' should have mode '0644'
|
|
40
|
+
|
|
41
|
+
Scenario: Directory exists
|
|
42
|
+
When I run 'mkdir -p /tmp/dirtest'
|
|
43
|
+
Then a directory named '/tmp/dirtest' should exist
|
|
44
|
+
|
|
45
|
+
Scenario: Directory does not exist
|
|
46
|
+
Then a directory named '/tmp/dirtest-m000' should not exist
|
|
47
|
+
|
|
48
|
+
Scenario: Directory mode
|
|
49
|
+
When I run 'mkdir -p /tmp/dirtest'
|
|
50
|
+
And I run 'chmod 755 /tmp/dirtest'
|
|
51
|
+
Then the directory named '/tmp/dirtest' should have mode '755'
|
|
52
|
+
And the directory named '/tmp/dirtest' should have mode '0755'
|
|
53
|
+
|
|
54
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Installation
|
|
2
|
+
To set up a cucumber-nagios project
|
|
3
|
+
A user
|
|
4
|
+
Must be able to install the gem
|
|
5
|
+
|
|
6
|
+
Scenario: Installing the gem
|
|
7
|
+
When I build the gem
|
|
8
|
+
And I install the latest gem
|
|
9
|
+
Then I should have cucumber-nagios-gen on my path
|
|
10
|
+
And I can generate a new project
|
|
11
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Given /^cucumber\-nagios is installed$/ do
|
|
2
|
+
When 'I build the gem'
|
|
3
|
+
And 'I install the latest gem'
|
|
4
|
+
Then 'I should have cucumber-nagios-gen on my path'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
When /^I create a new project called "([^\"]*)"$/ do |project_name|
|
|
8
|
+
@project_name = project_name
|
|
9
|
+
FileUtils.rm_rf("/tmp/#{@project_name}")
|
|
10
|
+
|
|
11
|
+
silent_system("cd /tmp ; cucumber-nagios-gen project #{@project_name}").should be_true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
When /^I freeze in dependencies$/ do
|
|
15
|
+
@project_name.should_not be_nil
|
|
16
|
+
silent_system("cd /tmp/#{@project_name} ; bundle install").should be_true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Then /^a Gemfile lock should be created$/ do
|
|
20
|
+
@project_name.should_not be_nil
|
|
21
|
+
File.exists?("/tmp/#{@project_name}/Gemfile.lock").should be_true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
When /^I build the gem$/ do
|
|
2
|
+
project_root = File.join(File.dirname(__FILE__), '..', '..')
|
|
3
|
+
rakefile = File.join(project_root, 'Rakefile')
|
|
4
|
+
File.exist?(rakefile).should be_true
|
|
5
|
+
|
|
6
|
+
silent_system("rake -f #{rakefile} build").should be_true
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When /^I install the latest gem$/ do
|
|
10
|
+
project_root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
|
|
11
|
+
pkg_dir = project_root.join('pkg')
|
|
12
|
+
glob = File.join(pkg_dir, '*.gem')
|
|
13
|
+
latest = Dir.glob(glob).sort {|a, b| File.ctime(a) <=> File.ctime(b) }.last
|
|
14
|
+
|
|
15
|
+
silent_system("gem install #{latest} 2>&1 > /dev/null").should be_true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Then /^I should have cucumber\-nagios\-gen on my path$/ do
|
|
19
|
+
silent_system("which cucumber-nagios-gen").should be_true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Then /^I can generate a new project$/ do
|
|
23
|
+
testproj = "testproj-#{Time.now.to_i}"
|
|
24
|
+
FileUtils.rm_rf("/tmp/#{testproj}")
|
|
25
|
+
|
|
26
|
+
silent_system("cd /tmp ; cucumber-nagios-gen project #{testproj}").should be_true
|
|
27
|
+
File.exists?("/tmp/#{testproj}").should be_true
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Given /^a project called "([^\"]*)" is created and frozen$/ do |project_name|
|
|
2
|
+
@project_name = project_name
|
|
3
|
+
Given 'cucumber-nagios is installed'
|
|
4
|
+
When "I create a new project called \"#{@project_name}\""
|
|
5
|
+
And 'I freeze in dependencies'
|
|
6
|
+
Then 'a Gemfile lock should be created'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When /^I generate a new feature called "([^\"]*)" for "([^\"]*)"$/ do |feature, site|
|
|
10
|
+
silent_system("cd /tmp/#{@project_name} ; cucumber-nagios-gen feature #{site} #{feature}")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then /^a feature file should exist for "([^\"]*)" on "([^\"]*)"$/ do |feature, site|
|
|
14
|
+
File.exists?("/tmp/#{@project_name}/features/#{site}/#{feature}.feature").should be_true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then /^the "([^\"]*)" feature on "([^\"]*)" should exit cleanly$/ do |feature, site|
|
|
18
|
+
silent_system("cd /tmp/#{@project_name} ; bin/cucumber-nagios features/#{site}/#{feature}.feature").should be_true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then /^the "([^\"]*)" feature on "([^\"]*)" should not exit cleanly$/ do |feature, site|
|
|
22
|
+
silent_system("cd /tmp/#{@project_name} ; bin/cucumber-nagios features/#{site}/#{feature}.feature").should be_false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
When /^the "([^\"]*)" feature on "([^\"]*)" checks for something preposterous$/ do |feature, site|
|
|
26
|
+
file_name = "/tmp/#{@project_name}/features/#{site}/#{feature}.feature"
|
|
27
|
+
File.open(file_name,'a') do |file|
|
|
28
|
+
file << " Then I should see \"supercalifragilisticexpialidocious\""
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Then /^"([^"]*)" in the "([^"]*)" project should not exist$/ do |file, project_name|
|
|
33
|
+
filename = File.join(file, project_name)
|
|
34
|
+
File.exists?(filename).should be_false
|
|
35
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
|
4
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
|
5
|
+
|
|
6
|
+
require 'cucumber/nagios/steps'
|
|
7
|
+
require 'webrat_logging_patches'
|
|
8
|
+
|
|
9
|
+
World do
|
|
10
|
+
Webrat::Session.new(Webrat::MechanizeAdapter.new)
|
|
11
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Using features
|
|
2
|
+
To test websites
|
|
3
|
+
A cucumber feature
|
|
4
|
+
Must be created
|
|
5
|
+
|
|
6
|
+
Scenario: Create a feature
|
|
7
|
+
Given cucumber-nagios is installed
|
|
8
|
+
And a project called "more-great-tests" is created and frozen
|
|
9
|
+
When I generate a new feature called "login" for "github.com"
|
|
10
|
+
Then a feature file should exist for "login" on "github.com"
|
|
11
|
+
|
|
12
|
+
Scenario: Run a successful feature
|
|
13
|
+
Given a project called "passing-features" is created and frozen
|
|
14
|
+
When I generate a new feature called "homepage" for "github.com"
|
|
15
|
+
Then the "homepage" feature on "github.com" should exit cleanly
|
|
16
|
+
|
|
17
|
+
Scenario: Run a failing feature
|
|
18
|
+
Given a project called "failing-features" is created and frozen
|
|
19
|
+
When I generate a new feature called "profile" for "github.com"
|
|
20
|
+
And the "profile" feature on "github.com" checks for something preposterous
|
|
21
|
+
Then the "profile" feature on "github.com" should not exit cleanly
|
|
22
|
+
|
|
23
|
+
Scenario: webrat.log output
|
|
24
|
+
Given a project called "passing-features" is created and frozen
|
|
25
|
+
When I generate a new feature called "homepage" for "github.com"
|
|
26
|
+
Then the "homepage" feature on "github.com" should exit cleanly
|
|
27
|
+
Then "webrat.log" in the "passing-features" project should not exist
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
When /I fetch (.*)/ do | url |
|
|
2
|
+
visit url
|
|
3
|
+
@url_headers = response.header
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Then /^the "(.*)" header should be "(.*)"$/ do | header_name, header_value|
|
|
7
|
+
@url_headers[header_name].should == header_value
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Then /^the response should contain the "(.*)" header$/ do | header_name |
|
|
11
|
+
@url_headers.should have_key(header_name.downcase)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
### header contains checks
|
|
15
|
+
Then /^the "(.*)" header should contain "(.*)"$/ do | header_name, header_contains |
|
|
16
|
+
@url_headers[header_name].should match header_contains
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Then /^the "(.*)" header should not contain "(.*)"$/ do | header_name, header_contains |
|
|
20
|
+
@url_headers[header_name].should_not match header_contains
|
|
21
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
source :rubygems
|
|
2
2
|
|
|
3
3
|
gem "cucumber-nagios"
|
|
4
|
-
gem "cucumber", "0.
|
|
5
|
-
gem "rspec", "
|
|
6
|
-
gem "webrat", "0.7.
|
|
7
|
-
gem "mechanize", "0.
|
|
4
|
+
gem "cucumber", "0.10.0"
|
|
5
|
+
gem "rspec", "2.3.0"
|
|
6
|
+
gem "webrat", "0.7.2"
|
|
7
|
+
gem "mechanize", "1.0.0"
|
|
8
8
|
gem "templater", "1.0.0"
|
|
9
9
|
gem "net-ssh", "2.0.18"
|
|
10
10
|
gem "amqp", "0.6.7"
|
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
Bundling dependencies
|
|
3
3
|
=====================
|
|
4
4
|
|
|
5
|
-
Bundling cucumber-nagios's dependencies allows you to drop your cucumber-nagios
|
|
6
|
-
project to any machine and have it run. This can be useful if you want to
|
|
5
|
+
Bundling cucumber-nagios's dependencies allows you to drop your cucumber-nagios
|
|
6
|
+
project to any machine and have it run. This can be useful if you want to
|
|
7
7
|
develop your tests on one machine, and deploy them to another (like a production
|
|
8
|
-
Nagios server).
|
|
8
|
+
Nagios server).
|
|
9
9
|
|
|
10
|
-
You'll need to bundle your dependencies to use cucumber-nagios.
|
|
10
|
+
You'll need to bundle your dependencies to use cucumber-nagios.
|
|
11
11
|
|
|
12
|
-
First you need to make sure the following dependencies are installed:
|
|
12
|
+
First you need to make sure the following dependencies are installed:
|
|
13
13
|
|
|
14
14
|
- RubyGems
|
|
15
|
-
|
|
15
|
+
- bundler gem (automatically pulled in by the cucumber-nagios gem)
|
|
16
16
|
|
|
17
17
|
To bundle your dependencies, within your project directory run:
|
|
18
18
|
|
|
19
|
-
$ gem bundle
|
|
19
|
+
$ gem bundle
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
Version control
|
|
23
23
|
===============
|
|
24
24
|
|
|
25
|
-
It's strongly recommend that you store your cucumber-nagios projects in a
|
|
25
|
+
It's strongly recommend that you store your cucumber-nagios projects in a
|
|
26
26
|
version control system!
|
|
27
27
|
|
|
28
|
-
To get up and running with git:
|
|
28
|
+
To get up and running with git:
|
|
29
29
|
|
|
30
30
|
$ git init
|
|
31
31
|
$ git add .
|
|
@@ -43,25 +43,25 @@ To get up and running with bzr:
|
|
|
43
43
|
Writing features
|
|
44
44
|
================
|
|
45
45
|
|
|
46
|
-
You can use the
|
|
47
|
-
you. It takes two arguments: the site you're testing, and feature you're testing:
|
|
46
|
+
You can use the cucumber-nagios-gen command to generate new features for
|
|
47
|
+
you. It takes two arguments: the site you're testing, and feature you're testing:
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
cucumber-nagios-gen feature gnome.org navigation
|
|
50
50
|
|
|
51
|
-
This will generate two files:
|
|
51
|
+
This will generate two files:
|
|
52
52
|
|
|
53
53
|
features/gnome.org/navigation.feature
|
|
54
54
|
features/gnome.org/steps/navigation_steps.rb
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
As for writing features, you'll want to have a read of the Cucumber
|
|
57
|
+
As for writing features, you'll want to have a read of the Cucumber
|
|
58
58
|
documentation[0], however your tests will look something like this:
|
|
59
59
|
|
|
60
60
|
Feature: google.com.au
|
|
61
61
|
To broaden their knowledge
|
|
62
62
|
A user should be able
|
|
63
63
|
To search for things
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
Scenario: Searching for things
|
|
66
66
|
Given I visit "http://www.google.com"
|
|
67
67
|
When I fill in "q" with "wikipedia"
|
|
@@ -69,56 +69,56 @@ documentation[0], however your tests will look something like this:
|
|
|
69
69
|
Then I should see "www.wikipedia.org"
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
There's a collection of steps that will cover most of the things you'll be
|
|
73
|
-
testing for in features/steps/webrat_steps.rb.
|
|
72
|
+
There's a collection of steps that will cover most of the things you'll be
|
|
73
|
+
testing for in features/steps/webrat_steps.rb.
|
|
74
74
|
|
|
75
75
|
You can write custom steps for testing specific output and behaviour, e.g.
|
|
76
|
-
in features/smh.com.au/smh.feature:
|
|
76
|
+
in features/smh.com.au/smh.feature:
|
|
77
77
|
|
|
78
78
|
Feature: smh.com.au
|
|
79
79
|
It should be up
|
|
80
80
|
And provide links to content
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
Scenario: Visiting home page
|
|
83
83
|
When I go to http://smh.com.au/
|
|
84
84
|
Then I should see site navigation
|
|
85
85
|
And there should be a section named "Opinion"
|
|
86
86
|
|
|
87
|
-
There aren't steps for "Then I should see site navigation", so you have to
|
|
88
|
-
write one yourself. :-) In features/smh.com.au/steps/smh_steps.rb:
|
|
87
|
+
There aren't steps for "Then I should see site navigation", so you have to
|
|
88
|
+
write one yourself. :-) In features/smh.com.au/steps/smh_steps.rb:
|
|
89
89
|
|
|
90
|
-
Then /^I should see site navigation$/ do
|
|
91
|
-
doc = Nokogiri::HTML(response.body.to_s)
|
|
92
|
-
doc.css("ul#nav li a").size.should > 5
|
|
90
|
+
Then /^I should see site navigation$/ do
|
|
91
|
+
doc = Nokogiri::HTML(response.body.to_s)
|
|
92
|
+
doc.css("ul#nav li a").size.should > 5
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
You can use Nokogiri for testing responses with XPath matchers and CSS
|
|
96
|
-
selectors.
|
|
95
|
+
You can use Nokogiri for testing responses with XPath matchers and CSS
|
|
96
|
+
selectors.
|
|
97
97
|
|
|
98
|
-
I suggest you use
|
|
98
|
+
I suggest you use `cucumber` directly so you can get better feedback when
|
|
99
99
|
writing your tests:
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
cucumber --require features/ features/smh/smh.feature
|
|
102
102
|
|
|
103
|
-
This will output using the default 'pretty' formatter.
|
|
103
|
+
This will output using the default 'pretty' formatter.
|
|
104
104
|
|
|
105
105
|
Running
|
|
106
106
|
=======
|
|
107
107
|
|
|
108
|
-
Invoke the Cucumber feature with the cucumber-nagios script:
|
|
108
|
+
Invoke the Cucumber feature with the cucumber-nagios script:
|
|
109
109
|
|
|
110
110
|
bin/cucumber-nagios features/smh.com.au/smh.feature
|
|
111
111
|
|
|
112
|
-
cucumber-nagios can be run from anywhere:
|
|
112
|
+
cucumber-nagios can be run from anywhere:
|
|
113
113
|
|
|
114
114
|
/path/to/bin/cucumber-nagios /path/to/features/smh/smh.feature
|
|
115
115
|
|
|
116
|
-
It should return a standard Nagios-formatted response string:
|
|
116
|
+
It should return a standard Nagios-formatted response string:
|
|
117
117
|
|
|
118
118
|
Critical: 0, Warning: 0, 2 okay | passed=2, failed=0, total=2
|
|
119
119
|
|
|
120
|
-
Steps that fail will show up in the "Critical" total, and steps that pass
|
|
121
|
-
show up in the "okay" total.
|
|
120
|
+
Steps that fail will show up in the "Critical" total, and steps that pass
|
|
121
|
+
show up in the "okay" total.
|
|
122
122
|
|
|
123
123
|
The value printed at the end is in Nagios's Performance Data format, so it
|
|
124
124
|
can be graphed and the like.
|
|
@@ -130,37 +130,37 @@ Quirks & Caveats
|
|
|
130
130
|
Multiple scenarios
|
|
131
131
|
------------------
|
|
132
132
|
|
|
133
|
-
You may want to think about keeping to one scenario to a file, otherwise
|
|
133
|
+
You may want to think about keeping to one scenario to a file, otherwise
|
|
134
134
|
you'll get multiple lines of output for a test:
|
|
135
135
|
|
|
136
136
|
Critical: 1, Warning: 0, 2 okay | passed=2, failed=1, total=3
|
|
137
137
|
Critical: 1, Warning: 0, 4 okay | passed=4, failed=1, total=5
|
|
138
138
|
|
|
139
|
-
That said, Nagios should only read the last line, so this might be an ok
|
|
139
|
+
That said, Nagios should only read the last line, so this might be an ok
|
|
140
140
|
behaviour when you want to test for an aggregate of failures across a site.
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
Failure *is* an option (exceptions are good)
|
|
144
144
|
--------------------------------------------
|
|
145
145
|
|
|
146
|
-
Exceptions raised within your tests will appear in the failed totals, so you
|
|
147
|
-
don't need to worry about trying to catch them in your own custom steps.
|
|
146
|
+
Exceptions raised within your tests will appear in the failed totals, so you
|
|
147
|
+
don't need to worry about trying to catch them in your own custom steps.
|
|
148
148
|
|
|
149
|
-
i.e. if you try fetching a page on a server that is down, or the page returns
|
|
150
|
-
a 404, the exception raised by Mechanize just gets treated by Cucumber as a
|
|
151
|
-
test failure.
|
|
149
|
+
i.e. if you try fetching a page on a server that is down, or the page returns
|
|
150
|
+
a 404, the exception raised by Mechanize just gets treated by Cucumber as a
|
|
151
|
+
test failure.
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
Deploying to production
|
|
155
155
|
=======================
|
|
156
156
|
|
|
157
|
-
Once you've copied your project around, just run the bundler again:
|
|
157
|
+
Once you've copied your project around, just run the bundler again:
|
|
158
158
|
|
|
159
159
|
$ gem bundle
|
|
160
160
|
|
|
161
|
-
You'll need to have RubyGems and the bundler gem installed on the system
|
|
161
|
+
You'll need to have RubyGems and the bundler gem installed on the system
|
|
162
162
|
you're deploying too. I know, this is not optimal, but hopefully the bundler
|
|
163
|
-
gem will handle this better in the future.
|
|
163
|
+
gem will handle this better in the future.
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
[0] http://wiki.github.com/aslakhellesoy/cucumber
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
require 'pathname'
|
|
4
|
+
|
|
3
5
|
unless ARGV[0]
|
|
4
6
|
puts "Usage: #{__FILE__} <feature> [--debug|--pretty]"
|
|
5
7
|
exit 4
|
|
6
8
|
end
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
feature = ARGV[0]
|
|
12
|
-
unless File.exists?(feature)
|
|
13
|
-
feature = File.join(features_dir, ARGV[0])
|
|
14
|
-
end
|
|
10
|
+
root = Pathname.new(File.dirname(__FILE__)).expand_path
|
|
11
|
+
feature_dir = root.join('..', 'features').expand_path
|
|
12
|
+
feature, line = ARGV[0].split(':')
|
|
15
13
|
|
|
16
14
|
unless File.exist?(feature)
|
|
17
|
-
puts "Error: feature file doesn't exist!"
|
|
15
|
+
puts "Error: feature file '#{feature}' doesn't exist!"
|
|
18
16
|
exit 4
|
|
19
17
|
end
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
command_parts << "--format Cucumber::Formatter::Nagios"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
command_parts << feature
|
|
32
|
-
command = command_parts.join(' ')
|
|
19
|
+
parts = []
|
|
20
|
+
parts << "cucumber"
|
|
21
|
+
parts << "--require #{feature_dir}"
|
|
22
|
+
parts << "--format pretty" if ARGV.include?("--pretty")
|
|
23
|
+
parts << "--format Cucumber::Formatter::Nagios" unless ARGV.include?("--pretty")
|
|
24
|
+
parts << "#{line ? "#{feature}:#{line}" : feature }"
|
|
25
|
+
command = parts.join(' ')
|
|
33
26
|
|
|
34
27
|
if ARGV.grep(/^\-\-debug$/).size > 0
|
|
35
28
|
puts command
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cucumber-nagios
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 59
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 8
|
|
9
|
-
-
|
|
10
|
-
version: 0.8.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.8.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Lindsay Holmwood
|
|
@@ -16,102 +16,102 @@ bindir: bin
|
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
18
|
date: 2010-12-30 00:00:00 +11:00
|
|
19
|
-
default_executable:
|
|
19
|
+
default_executable: cucumber-nagios-gen
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
|
-
name:
|
|
22
|
+
name: cucumber
|
|
23
23
|
prerelease: false
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
25
|
none: false
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
29
|
+
hash: 55
|
|
30
30
|
segments:
|
|
31
|
-
- 1
|
|
32
31
|
- 0
|
|
32
|
+
- 10
|
|
33
33
|
- 0
|
|
34
|
-
version:
|
|
34
|
+
version: 0.10.0
|
|
35
35
|
type: :runtime
|
|
36
36
|
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
|
-
name:
|
|
38
|
+
name: rspec
|
|
39
39
|
prerelease: false
|
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
41
|
none: false
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
hash:
|
|
45
|
+
hash: 3
|
|
46
46
|
segments:
|
|
47
|
-
-
|
|
48
|
-
- 8
|
|
47
|
+
- 2
|
|
49
48
|
- 3
|
|
50
|
-
|
|
49
|
+
- 0
|
|
50
|
+
version: 2.3.0
|
|
51
51
|
type: :runtime
|
|
52
52
|
version_requirements: *id002
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
|
-
name:
|
|
54
|
+
name: webrat
|
|
55
55
|
prerelease: false
|
|
56
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
57
57
|
none: false
|
|
58
58
|
requirements:
|
|
59
59
|
- - "="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
hash:
|
|
61
|
+
hash: 7
|
|
62
62
|
segments:
|
|
63
63
|
- 0
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
version: 0.
|
|
64
|
+
- 7
|
|
65
|
+
- 2
|
|
66
|
+
version: 0.7.2
|
|
67
67
|
type: :runtime
|
|
68
68
|
version_requirements: *id003
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: mechanize
|
|
71
71
|
prerelease: false
|
|
72
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
73
73
|
none: false
|
|
74
74
|
requirements:
|
|
75
|
-
- - "
|
|
75
|
+
- - "="
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
hash:
|
|
77
|
+
hash: 23
|
|
78
78
|
segments:
|
|
79
|
-
- 0
|
|
80
|
-
- 6
|
|
81
79
|
- 1
|
|
82
|
-
|
|
80
|
+
- 0
|
|
81
|
+
- 0
|
|
82
|
+
version: 1.0.0
|
|
83
83
|
type: :runtime
|
|
84
84
|
version_requirements: *id004
|
|
85
85
|
- !ruby/object:Gem::Dependency
|
|
86
|
-
name:
|
|
86
|
+
name: templater
|
|
87
87
|
prerelease: false
|
|
88
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
|
89
89
|
none: false
|
|
90
90
|
requirements:
|
|
91
|
-
- - "
|
|
91
|
+
- - ">="
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
hash:
|
|
93
|
+
hash: 23
|
|
94
94
|
segments:
|
|
95
|
-
-
|
|
95
|
+
- 1
|
|
96
96
|
- 0
|
|
97
|
-
-
|
|
98
|
-
version:
|
|
97
|
+
- 0
|
|
98
|
+
version: 1.0.0
|
|
99
99
|
type: :runtime
|
|
100
100
|
version_requirements: *id005
|
|
101
101
|
- !ruby/object:Gem::Dependency
|
|
102
|
-
name:
|
|
102
|
+
name: net-ssh
|
|
103
103
|
prerelease: false
|
|
104
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
105
105
|
none: false
|
|
106
106
|
requirements:
|
|
107
107
|
- - "="
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
hash:
|
|
109
|
+
hash: 43
|
|
110
110
|
segments:
|
|
111
|
+
- 2
|
|
111
112
|
- 0
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
version: 0.7.0
|
|
113
|
+
- 18
|
|
114
|
+
version: 2.0.18
|
|
115
115
|
type: :runtime
|
|
116
116
|
version_requirements: *id006
|
|
117
117
|
- !ruby/object:Gem::Dependency
|
|
@@ -131,66 +131,101 @@ dependencies:
|
|
|
131
131
|
type: :runtime
|
|
132
132
|
version_requirements: *id007
|
|
133
133
|
- !ruby/object:Gem::Dependency
|
|
134
|
-
name:
|
|
134
|
+
name: bundler
|
|
135
135
|
prerelease: false
|
|
136
136
|
requirement: &id008 !ruby/object:Gem::Requirement
|
|
137
137
|
none: false
|
|
138
138
|
requirements:
|
|
139
|
-
- - "
|
|
139
|
+
- - "="
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
|
-
hash:
|
|
141
|
+
hash: 25
|
|
142
142
|
segments:
|
|
143
143
|
- 1
|
|
144
|
-
- 3
|
|
145
144
|
- 0
|
|
146
|
-
|
|
145
|
+
- 7
|
|
146
|
+
version: 1.0.7
|
|
147
147
|
type: :runtime
|
|
148
148
|
version_requirements: *id008
|
|
149
|
+
- !ruby/object:Gem::Dependency
|
|
150
|
+
name: rake
|
|
151
|
+
prerelease: false
|
|
152
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
|
153
|
+
none: false
|
|
154
|
+
requirements:
|
|
155
|
+
- - ">="
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
hash: 57
|
|
158
|
+
segments:
|
|
159
|
+
- 0
|
|
160
|
+
- 8
|
|
161
|
+
- 3
|
|
162
|
+
version: 0.8.3
|
|
163
|
+
type: :development
|
|
164
|
+
version_requirements: *id009
|
|
149
165
|
description: cucumber-nagios helps you write high-level behavioural tests for your web applications and Unix infrastructure that can be plugged into Nagios.
|
|
150
166
|
email: lindsay@holmwood.id.au
|
|
151
167
|
executables:
|
|
152
168
|
- cucumber-nagios-gen
|
|
153
169
|
extensions: []
|
|
154
170
|
|
|
155
|
-
extra_rdoc_files:
|
|
156
|
-
|
|
171
|
+
extra_rdoc_files:
|
|
172
|
+
- LICENSE
|
|
173
|
+
- README.md
|
|
174
|
+
- TODO
|
|
157
175
|
files:
|
|
176
|
+
- .gitignore
|
|
177
|
+
- AUTHORS
|
|
178
|
+
- HACKING
|
|
179
|
+
- LICENSE
|
|
180
|
+
- README.md
|
|
181
|
+
- Rakefile
|
|
182
|
+
- TODO
|
|
183
|
+
- VERSION
|
|
158
184
|
- bin/cucumber-nagios-gen
|
|
185
|
+
- cucumber-nagios.gemspec
|
|
186
|
+
- features/commands.feature
|
|
187
|
+
- features/creating.feature
|
|
188
|
+
- features/files.feature
|
|
189
|
+
- features/http_steps.feature
|
|
190
|
+
- features/installing.feature
|
|
191
|
+
- features/steps/creating_steps.rb
|
|
192
|
+
- features/steps/installing_steps.rb
|
|
193
|
+
- features/steps/using_steps.rb
|
|
194
|
+
- features/support/env.rb
|
|
195
|
+
- features/support/silent_system.rb
|
|
196
|
+
- features/support/webrat_logging_patches.rb
|
|
197
|
+
- features/using.feature
|
|
198
|
+
- lib/cucumber-nagios.rb
|
|
159
199
|
- lib/cucumber/formatter/nagios.rb
|
|
200
|
+
- lib/cucumber/nagios.rb
|
|
160
201
|
- lib/cucumber/nagios/command.rb
|
|
202
|
+
- lib/cucumber/nagios/steps.rb
|
|
161
203
|
- lib/cucumber/nagios/steps/amqp_steps.rb
|
|
162
204
|
- lib/cucumber/nagios/steps/benchmark_steps.rb
|
|
163
205
|
- lib/cucumber/nagios/steps/command_steps.rb
|
|
164
206
|
- lib/cucumber/nagios/steps/dns_steps.rb
|
|
165
207
|
- lib/cucumber/nagios/steps/file_steps.rb
|
|
208
|
+
- lib/cucumber/nagios/steps/http_header_steps.rb
|
|
166
209
|
- lib/cucumber/nagios/steps/http_steps.rb
|
|
167
210
|
- lib/cucumber/nagios/steps/ping_steps.rb
|
|
168
211
|
- lib/cucumber/nagios/steps/ssh_steps.rb
|
|
169
|
-
- lib/cucumber/nagios/steps.rb
|
|
170
212
|
- lib/cucumber/nagios/support/env.rb
|
|
171
213
|
- lib/cucumber/nagios/support/webrat_logging_patches.rb
|
|
172
214
|
- lib/cucumber/nagios/version.rb
|
|
173
|
-
- lib/
|
|
174
|
-
- lib/
|
|
175
|
-
- lib/generators/project/bin/cucumber-nagios
|
|
215
|
+
- lib/generators/project/.bzrignore
|
|
216
|
+
- lib/generators/project/.gitignore
|
|
176
217
|
- lib/generators/project/Gemfile
|
|
218
|
+
- lib/generators/project/README
|
|
219
|
+
- lib/generators/project/bin/cucumber-nagios
|
|
177
220
|
- lib/generators/project/lib/generators/feature/%feature_name%.feature
|
|
178
221
|
- lib/generators/project/lib/generators/feature/%feature_name%_steps.rb
|
|
179
|
-
- lib/generators/project/README
|
|
180
|
-
- LICENSE
|
|
181
|
-
- README.md
|
|
182
|
-
- AUTHORS
|
|
183
|
-
- HACKING
|
|
184
|
-
- TODO
|
|
185
|
-
- lib/generators/project/.gitignore
|
|
186
|
-
- lib/generators/project/.bzrignore
|
|
187
222
|
has_rdoc: true
|
|
188
223
|
homepage: http://cucumber-nagios.org/
|
|
189
224
|
licenses: []
|
|
190
225
|
|
|
191
226
|
post_install_message:
|
|
192
|
-
rdoc_options:
|
|
193
|
-
|
|
227
|
+
rdoc_options:
|
|
228
|
+
- --charset=UTF-8
|
|
194
229
|
require_paths:
|
|
195
230
|
- lib
|
|
196
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -213,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
213
248
|
version: "0"
|
|
214
249
|
requirements: []
|
|
215
250
|
|
|
216
|
-
rubyforge_project:
|
|
251
|
+
rubyforge_project:
|
|
217
252
|
rubygems_version: 1.3.7
|
|
218
253
|
signing_key:
|
|
219
254
|
specification_version: 3
|