cucumber-scout 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.rdoc +70 -0
- data/Rakefile +32 -0
- data/config/scout.yml.example +4 -0
- data/cucumber-scout.gemspec +53 -0
- data/features/cucumber.feature +26 -0
- data/features/steps/config_steps.rb +20 -0
- data/features/support/env.rb +1 -0
- data/lib/cucumber/scout.rb +30 -0
- data/lib/cucumber/scout/steps.rb +29 -0
- data/lib/cucumber/scout/version.rb +5 -0
- metadata +88 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Jesse Newland
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
= cucumber-scout
|
2
|
+
|
3
|
+
Cucumber steps for verifying Scout[http://scoutapp.com] metrics
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
Install the gem:
|
8
|
+
|
9
|
+
gem install cucumber-scout
|
10
|
+
|
11
|
+
In your <tt>features/support/env.rb</tt>:
|
12
|
+
|
13
|
+
require 'cucumber/scout/steps'
|
14
|
+
|
15
|
+
You can now write crazy features like this:
|
16
|
+
|
17
|
+
Feature: Response Time
|
18
|
+
As a impatient user
|
19
|
+
Our app should be super fast
|
20
|
+
|
21
|
+
Background:
|
22
|
+
Given my Scout account name is 'railsmachine'
|
23
|
+
And my Scout email and password are 'jesse@railsmachine.com' and 'sekret'
|
24
|
+
|
25
|
+
Scenario: Passenger Queue
|
26
|
+
When I get the metrics from the 'Passenger' plugin on 'example.com'
|
27
|
+
Then the 'passenger_queue_depth' should be 0
|
28
|
+
|
29
|
+
Scenario: New Users are continuously being created
|
30
|
+
When I get the metrics from the 'Business Metrics' plugin on 'example.com'
|
31
|
+
Then 'new_users' should be greater than 0
|
32
|
+
|
33
|
+
Scenatiro: CPU usage is low
|
34
|
+
When I get the metrics from the 'Server Overview' plugin on 'example.com'
|
35
|
+
Then 'cpu_last_minute' should be less than 1
|
36
|
+
|
37
|
+
== Retrieving descriptors names from Scout
|
38
|
+
|
39
|
+
https://scoutapp.com/ACCOUNT_NAME/descriptors.xml?host=HOSTNAME
|
40
|
+
|
41
|
+
== Available Operators
|
42
|
+
|
43
|
+
* be greater than
|
44
|
+
* be less than
|
45
|
+
* equal OR be
|
46
|
+
* not equal OR not be
|
47
|
+
|
48
|
+
== Running Cucumber Features
|
49
|
+
|
50
|
+
Drop your account info into config/scout.yml, then run 'em like so:
|
51
|
+
|
52
|
+
cucumber features
|
53
|
+
|
54
|
+
The server you configure should have the Server Overview and Passenger Plugins
|
55
|
+
installed. I'll add fakeweb later, but for now, that's how it works.
|
56
|
+
|
57
|
+
== Note on Patches/Pull Requests
|
58
|
+
|
59
|
+
* Fork the project.
|
60
|
+
* Make your feature addition or bug fix.
|
61
|
+
* Add cucumber features for it. This is important so I don't break it in a
|
62
|
+
future version unintentionally.
|
63
|
+
* Commit, do not mess with rakefile, version, or history.
|
64
|
+
(if you want to have your own version, that is fine but bump version in a
|
65
|
+
commit by itself I can ignore when I pull)
|
66
|
+
* Send me a pull request. Bonus points for topic branches.
|
67
|
+
|
68
|
+
== Copyright
|
69
|
+
|
70
|
+
Copyright (c) 2010 Jesse Newland. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
$LOAD_PATH.unshift 'lib'
|
4
|
+
require 'cucumber/scout/version'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'jeweler'
|
8
|
+
Jeweler::Tasks.new do |gem|
|
9
|
+
gem.version = Cucumber::Scout::VERSION
|
10
|
+
gem.name = "cucumber-scout"
|
11
|
+
gem.summary = %Q{Cucumber steps for verifing metrics from Scout's API}
|
12
|
+
gem.description = %Q{Cucumber steps for verifing metrics from Scout's API}
|
13
|
+
gem.email = "jnewland@gmail.com"
|
14
|
+
gem.homepage = "http://github.com/jnewland/cucumber-scout"
|
15
|
+
gem.authors = ["Jesse Newland"]
|
16
|
+
gem.add_dependency "scout_scout", "~> 0.0.4"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rake/rdoctask'
|
25
|
+
Rake::RDocTask.new do |rdoc|
|
26
|
+
version = Cucumber::Scout::VERSION
|
27
|
+
|
28
|
+
rdoc.rdoc_dir = 'rdoc'
|
29
|
+
rdoc.title = "cucumber-scout #{version}"
|
30
|
+
rdoc.rdoc_files.include('README*')
|
31
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
+
end
|
@@ -0,0 +1,53 @@
|
|
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-scout}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jesse Newland"]
|
12
|
+
s.date = %q{2010-06-08}
|
13
|
+
s.description = %q{Cucumber steps for verifing metrics from Scout's API}
|
14
|
+
s.email = %q{jnewland@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"config/scout.yml.example",
|
26
|
+
"cucumber-scout.gemspec",
|
27
|
+
"features/cucumber.feature",
|
28
|
+
"features/steps/config_steps.rb",
|
29
|
+
"features/support/env.rb",
|
30
|
+
"lib/cucumber/scout.rb",
|
31
|
+
"lib/cucumber/scout/steps.rb",
|
32
|
+
"lib/cucumber/scout/version.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/jnewland/cucumber-scout}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.6}
|
38
|
+
s.summary = %q{Cucumber steps for verifing metrics from Scout's API}
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_runtime_dependency(%q<scout_scout>, ["~> 0.0.4"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<scout_scout>, ["~> 0.0.4"])
|
48
|
+
end
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<scout_scout>, ["~> 0.0.4"])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Feature: Setup
|
2
|
+
As a dev wanting to verify the Scout API
|
3
|
+
You should be able to initialize auth details in the background
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given we load our Scout account info from the config file
|
7
|
+
|
8
|
+
Scenario: Installing the gem
|
9
|
+
When a scenario runs
|
10
|
+
Then the Scout API is responsive
|
11
|
+
|
12
|
+
Scenario: Less than
|
13
|
+
When I get the metrics from the 'Server Overview' plugin on the test server
|
14
|
+
Then 'cpu_last_minute' should be less than 100
|
15
|
+
|
16
|
+
Scenario: Equal
|
17
|
+
When I get the metrics from the 'Passenger' plugin on the test server
|
18
|
+
Then 'passenger_queue_depth' should be 0
|
19
|
+
|
20
|
+
Scenario: Greater than
|
21
|
+
When I get the metrics from the 'Server Overview' plugin on the test server
|
22
|
+
Then 'cpu_last_minute' should be greater than 0.001
|
23
|
+
|
24
|
+
Scenario: Not equal
|
25
|
+
When I get the metrics from the 'Server Overview' plugin on the test server
|
26
|
+
Then 'cpu_last_minute' should not equal 100
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
Given 'we load our Scout account info from the config file' do
|
3
|
+
config = YAML.load_file(File.join(Dir.pwd, 'config', 'scout.yml'))
|
4
|
+
Given "our Scout account name is '"+config['account']+"'"
|
5
|
+
Given "our Scout email and password are '"+config['email']+"' and '"+config['password']+"'"
|
6
|
+
Given "I get the metrics from the 'Server Overview' plugin on the test server"
|
7
|
+
end
|
8
|
+
|
9
|
+
When /^a scenario runs$/ do
|
10
|
+
# noop
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^I get the metrics from the '([^\"]*)' plugin on the test server$/ do |plugin|
|
14
|
+
config = YAML.load_file(File.join(Dir.pwd, 'config', 'scout.yml'))
|
15
|
+
Given "I get the metrics from the '"+plugin+"' plugin on '"+config['hostname']+"'"
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^the Scout API is responsive$/ do
|
19
|
+
Then "'cpu_last_minute' should be less than 100"
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(Dir.pwd, 'lib', 'cucumber', 'scout', 'steps.rb')
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'scout_scout'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
module Scout
|
5
|
+
|
6
|
+
def self.scout_account=(name)
|
7
|
+
ScoutScout.account = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.scout_auth(email, password)
|
11
|
+
ScoutScout.basic_auth email, password
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_accessor :scout_hostname, :scout_plugin_name
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def self.value_for_hostname_plugin_and_descriptor(hostname=nil,plugin=nil,descriptor=nil)
|
21
|
+
hostname ||= self.scout_hostname
|
22
|
+
plugin ||= self.scout_plugin_name
|
23
|
+
ScoutScout::Server.first(hostname).plugins.find { |p| p.name.downcase == plugin.downcase }.descriptors.find { |d| d.name.downcase == descriptor.downcase }.value
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World(Cucumber::Scout)
|
30
|
+
require 'cucumber/nagios/steps'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'cucumber/scout'
|
2
|
+
|
3
|
+
Given /^(my|our) Scout account name is '([^\"]*)'$/ do |junk, name|
|
4
|
+
Cucumber::Scout.scout_account = name
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^(my|our) Scout email and password are '([^\"]*)' and '([^\"]*)'$/ do |junk, email, password|
|
8
|
+
Cucumber::Scout.scout_auth email, password
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^I get the metrics from the '([^\"]*)' plugin on '([^\"]*)'$/ do |plugin, hostname|
|
12
|
+
Cucumber::Scout.scout_hostname = hostname
|
13
|
+
Cucumber::Scout.scout_plugin_name = plugin
|
14
|
+
end
|
15
|
+
|
16
|
+
Then /^(the |)'([^\"]*)' should (be|be less than|be greater than|equal|not equal|not be) ([\d\.]+)( milliseconds| percent|)$/ do |predicate, metric, operator, intended_value, unit|
|
17
|
+
real_value = Cucumber::Scout.value_for_hostname_plugin_and_descriptor(Cucumber::Scout.scout_hostname, Cucumber::Scout.scout_plugin_name, metric).to_f
|
18
|
+
intended_value = intended_value.to_f
|
19
|
+
case operator
|
20
|
+
when 'be less than'
|
21
|
+
real_value.should < intended_value
|
22
|
+
when 'be greater than'
|
23
|
+
real_value.should > intended_value
|
24
|
+
when 'be', 'equal'
|
25
|
+
real_value.should == intended_value
|
26
|
+
when 'not be', 'not equal'
|
27
|
+
real_value.should_not == intended_value
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-scout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jesse Newland
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-08 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: scout_scout
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 0
|
30
|
+
- 4
|
31
|
+
version: 0.0.4
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Cucumber steps for verifing metrics from Scout's API
|
35
|
+
email: jnewland@gmail.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- LICENSE
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- .document
|
45
|
+
- .gitignore
|
46
|
+
- LICENSE
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- config/scout.yml.example
|
50
|
+
- cucumber-scout.gemspec
|
51
|
+
- features/cucumber.feature
|
52
|
+
- features/steps/config_steps.rb
|
53
|
+
- features/support/env.rb
|
54
|
+
- lib/cucumber/scout.rb
|
55
|
+
- lib/cucumber/scout/steps.rb
|
56
|
+
- lib/cucumber/scout/version.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/jnewland/cucumber-scout
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --charset=UTF-8
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.3.6
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: Cucumber steps for verifing metrics from Scout's API
|
87
|
+
test_files: []
|
88
|
+
|