resque-pagerduty 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +8 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -0
- data/LICENSE.md +19 -0
- data/README.md +129 -0
- data/Rakefile +11 -0
- data/lib/resque/failure/pagerduty.rb +77 -0
- data/lib/resque_pagerduty.rb +1 -0
- data/resque-pagerduty.gemspec +31 -0
- data/spec/resque/failure/pagerduty_spec.rb +208 -0
- data/spec/spec_helper.rb +8 -0
- metadata +185 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use 1.8.7@resque-pagerduty
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# v0.0.1 (2012-09-19)
|
2
|
+
|
3
|
+
* Initial release
|
4
|
+
|
5
|
+
# v0.1.0 (2012-09-20)
|
6
|
+
|
7
|
+
* Change name of gem to resque-pagerduty to conform with [resque's naming standard][resque-std]
|
8
|
+
* Documentation updates
|
9
|
+
* Travis CI integration
|
10
|
+
|
11
|
+
[resque-std]: https://github.com/defunkt/resque/blob/master/docs/PLUGINS.md
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2012 by Maeve Revels
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
# resque-pagerduty [![build status][build-img]][build-pg]
|
2
|
+
|
3
|
+
A Resque failure backend for triggering incidents in Pagerduty.
|
4
|
+
|
5
|
+
[build-img]: https://secure.travis-ci.org/maeve/resque-pagerduty.png
|
6
|
+
[build-pg]: http://travis-ci.org/#!/maeve/resque-pagerduty
|
7
|
+
|
8
|
+
## Dependencies ##
|
9
|
+
|
10
|
+
Depends on [Resque][resque] 1.7 or above.
|
11
|
+
|
12
|
+
Requires a subscription to [Pagerduty][pagerduty], with at least one Pagerduty
|
13
|
+
service configured with a service type of "Generic API".
|
14
|
+
|
15
|
+
[resque]: https://github.com/defunkt/resque
|
16
|
+
[pagerduty]: http://pagerduty.com
|
17
|
+
|
18
|
+
## Installation ##
|
19
|
+
|
20
|
+
To install from [Rubygems][rubygems]:
|
21
|
+
|
22
|
+
$ gem install resque-pagerduty
|
23
|
+
|
24
|
+
To use with bundler without adding explicit require statements to your code,
|
25
|
+
add the following to your Gemfile:
|
26
|
+
|
27
|
+
gem 'resque-pagerduty', :require => 'resque_pagerduty'
|
28
|
+
|
29
|
+
[rubygems]: http://rubygems.org/gems/resque-pagerduty
|
30
|
+
|
31
|
+
## Documentation ##
|
32
|
+
|
33
|
+
Complete documentation for this gem (including this README) is available on
|
34
|
+
[rubydoc.info][rubydoc].
|
35
|
+
|
36
|
+
General information about resque failure backends is available on the
|
37
|
+
[resque wiki][resque-failure].
|
38
|
+
|
39
|
+
The Pagerduty website provides more information about the
|
40
|
+
[Pagerduty Integration API][pd-integration-api].
|
41
|
+
|
42
|
+
[resque-failure]: https://github.com/defunkt/resque/wiki/Failure-Backends
|
43
|
+
[rubydoc]: http://rubydoc.info/gems/resque-pagerduty/frames
|
44
|
+
[pd-integration-api]: http://developer.pagerduty.com/documentation/integration/events
|
45
|
+
|
46
|
+
## Pagerduty Configuration ##
|
47
|
+
|
48
|
+
To trigger incidents in the same Pagerduty service across all jobs, configure
|
49
|
+
the failure backend with a Pagerduty service key:
|
50
|
+
|
51
|
+
Resque::Failure::Pagerduty.configure do |config|
|
52
|
+
config.service_key = 'my_pagerduty_service_key'
|
53
|
+
end
|
54
|
+
|
55
|
+
This service must be set up as a "Generic API" service in Pagerduty. The
|
56
|
+
service key GUID can be found on the Pagerduty service details page.
|
57
|
+
|
58
|
+
You may want to have different jobs trigger incidents in different Pagerduty
|
59
|
+
services. When handling an exception, the failure backend will automatically
|
60
|
+
look for a class method named `pagerduty_service_key` on the resque payload
|
61
|
+
class, and will preferentially use that callback. If this callback does not
|
62
|
+
exist on the job class, it will default to using the `service_key` configured
|
63
|
+
on the backend itself. For example:
|
64
|
+
|
65
|
+
class MyJob
|
66
|
+
@queue = :my_queue
|
67
|
+
|
68
|
+
def self.pagerduty_service_key
|
69
|
+
'my_custom_service_key'
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.perform(my_arg)
|
73
|
+
# Some code that could raise an exception goes here
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
If the `MyJob.perform` method raises an exception during processing, the
|
78
|
+
failure backend would use the `MyJob.pagerduty_service_key` instead of the
|
79
|
+
`Resque::Failure::Pagerduty.service_key` to trigger the incident.
|
80
|
+
|
81
|
+
When there is no `Resque::Failure::Pagerduty.service_key` configured, and
|
82
|
+
there is no `pagerduty_service_key` callback defined on the job class, then the
|
83
|
+
failure backend will exit gracefully. This allows you to selectively enable
|
84
|
+
Pagerduty notifications for some jobs without enabling them for all jobs.
|
85
|
+
|
86
|
+
## Examples ##
|
87
|
+
|
88
|
+
### Single Resque Failure Backend ###
|
89
|
+
|
90
|
+
Using only the Pagerduty failure backend:
|
91
|
+
|
92
|
+
require 'resque/failure/pagerduty'
|
93
|
+
|
94
|
+
Resque::Failure::Pagerduty.configure do |config|
|
95
|
+
config.service_key = 'my_pagerduty_service_key'
|
96
|
+
end
|
97
|
+
|
98
|
+
Resque::Failure.backend = Resque::Failure::Pagerduty
|
99
|
+
|
100
|
+
### Multiple Resque Failure Backends ###
|
101
|
+
|
102
|
+
Using both the Redis and Pagerduty failure backends:
|
103
|
+
|
104
|
+
require 'resque/failure/pagerduty'
|
105
|
+
require 'resque/failure/redis'
|
106
|
+
require 'resque/failure/multiple'
|
107
|
+
|
108
|
+
Resque::Failure::Pagerduty.configure do |config|
|
109
|
+
config.service_key = 'my_pagerduty_service_key'
|
110
|
+
end
|
111
|
+
|
112
|
+
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Pagerduty]
|
113
|
+
Resque::Failure.backend = Resque::Failure::Multiple
|
114
|
+
|
115
|
+
## Contributing ##
|
116
|
+
|
117
|
+
1. [Fork the repository.][fork]
|
118
|
+
2. [Create a topic branch.][branch]
|
119
|
+
3. `bundle install`
|
120
|
+
4. `rake spec`
|
121
|
+
5. Implement your feature or bug fix, including [specs][rspec].
|
122
|
+
6. [Add, commit, and push][gitref] your changes to your fork.
|
123
|
+
7. [Submit a pull request.][pr]
|
124
|
+
|
125
|
+
[fork]: https://help.github.com/articles/fork-a-repo
|
126
|
+
[branch]: http://learn.github.com/p/branching.html
|
127
|
+
[rspec]: http://github.com/rspec/rspec
|
128
|
+
[gitref]: http://gitref.org/
|
129
|
+
[pr]: http://help.github.com/send-pull-requests/
|
data/Rakefile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'resque'
|
2
|
+
require 'redphone/pagerduty'
|
3
|
+
|
4
|
+
module Resque
|
5
|
+
module Failure
|
6
|
+
# A Resque failure backend that handles exceptions by triggering
|
7
|
+
# incidents in the Pagerduty API
|
8
|
+
class Pagerduty < Base
|
9
|
+
class << self
|
10
|
+
# The default GUID of the Pagerduty "Generic API" service to be notified.
|
11
|
+
# This is the "service key" listed on a Generic API's service detail page
|
12
|
+
# in the Pagerduty app.
|
13
|
+
attr_accessor :service_key
|
14
|
+
end
|
15
|
+
|
16
|
+
# The GUID of the Pagerduty "Generic API" service to be notified.
|
17
|
+
# If a `pagerduty_service_key` callback is implemented on the payload
|
18
|
+
# class, then that will be used. Otherwise, the default
|
19
|
+
# {Resque::Failure::Pagerduty.service_key} will be used.
|
20
|
+
#
|
21
|
+
# @see .configure
|
22
|
+
def service_key
|
23
|
+
payload_class = Module.const_get(payload['class'])
|
24
|
+
if (payload_class.respond_to?(:pagerduty_service_key) &&
|
25
|
+
!payload_class.pagerduty_service_key.nil?)
|
26
|
+
payload_class.pagerduty_service_key
|
27
|
+
else
|
28
|
+
self.class.service_key
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Configure the failure backend for the Pagerduty API.
|
33
|
+
#
|
34
|
+
# @example Minimal configuration
|
35
|
+
# Resque::Failure::Pagerduty.configure do |config|
|
36
|
+
# config.service_key = '123abc456def'
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# @see .service_key
|
40
|
+
def self.configure
|
41
|
+
yield self
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
# Reset configured values.
|
46
|
+
# @see .configure
|
47
|
+
def self.reset
|
48
|
+
self.service_key = nil
|
49
|
+
end
|
50
|
+
|
51
|
+
# Trigger an incident in Pagerduty when a job fails.
|
52
|
+
def save
|
53
|
+
if service_key
|
54
|
+
pagerduty_client.trigger_incident(
|
55
|
+
:description => "#{exception.class} in #{payload['class']}: #{exception.message}",
|
56
|
+
:details => {:queue => queue,
|
57
|
+
:worker => worker.to_s,
|
58
|
+
:payload => payload,
|
59
|
+
:exception => {:class => exception.class.name,
|
60
|
+
:message => exception.message,
|
61
|
+
:backtrace => exception.backtrace}}
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def pagerduty_client
|
68
|
+
Redphone::Pagerduty.new(
|
69
|
+
:service_key => service_key,
|
70
|
+
:subdomain => '',
|
71
|
+
:user => '',
|
72
|
+
:password => ''
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'resque/failure/pagerduty'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "resque-pagerduty"
|
6
|
+
s.version = "0.1.0"
|
7
|
+
s.authors = ["Maeve Revels"]
|
8
|
+
s.email = ["maeve.revels@g5platform.com"]
|
9
|
+
s.homepage = "http://github.com/maeve/resque-pagerduty"
|
10
|
+
s.summary = "A Resque failure backend for Pagerduty"
|
11
|
+
s.description = <<-HERE
|
12
|
+
resque-pagerduty provides a Resque failure backend that triggers a Pagerduty
|
13
|
+
incident when an exception is raised by a job.
|
14
|
+
HERE
|
15
|
+
|
16
|
+
s.rubyforge_project = "resque-pagerduty"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency('resque', '~>1.7')
|
24
|
+
s.add_dependency('redphone', '~>0.0.6')
|
25
|
+
|
26
|
+
s.add_development_dependency('rake')
|
27
|
+
s.add_development_dependency('rspec', '~>2.11')
|
28
|
+
s.add_development_dependency('webmock', '~>1.7')
|
29
|
+
s.add_development_dependency('yard', '~>0.8')
|
30
|
+
s.add_development_dependency('redcarpet')
|
31
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Resque::Failure::Pagerduty do
|
4
|
+
after { Resque::Failure::Pagerduty.reset }
|
5
|
+
|
6
|
+
describe 'instance methods' do
|
7
|
+
subject { backend }
|
8
|
+
let(:backend) { Resque::Failure::Pagerduty.new(exception, worker, queue, payload) }
|
9
|
+
|
10
|
+
let(:exception) do
|
11
|
+
error = StandardError.new('This is a test exception message')
|
12
|
+
error.set_backtrace(['dummy_file.rb:23','dummy_file.rb:42'])
|
13
|
+
error
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:worker) { mock(:worker, :log => nil, :to_s => 'local.worker:1234') }
|
17
|
+
let(:queue) { 'my_queue' }
|
18
|
+
|
19
|
+
let(:payload) do
|
20
|
+
{'class' => payload_class.name,
|
21
|
+
'args' => payload_args}
|
22
|
+
end
|
23
|
+
let(:payload_class) { Class.new }
|
24
|
+
before { stub_const('TestPayloadClass', payload_class) }
|
25
|
+
|
26
|
+
let(:payload_args) { [123] }
|
27
|
+
|
28
|
+
describe '#initialize' do
|
29
|
+
its(:exception) { should == exception }
|
30
|
+
its(:worker) { should == worker }
|
31
|
+
its(:queue) { should == queue }
|
32
|
+
its(:payload) { should == payload }
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#service_key' do
|
36
|
+
subject { backend.service_key }
|
37
|
+
|
38
|
+
context 'when the backend class has a service_key' do
|
39
|
+
before { Resque::Failure::Pagerduty.service_key = default_service_key }
|
40
|
+
let(:default_service_key) { 'class123abc456def' }
|
41
|
+
|
42
|
+
context 'when the payload class has a pagerduty_service_key' do
|
43
|
+
before { payload_class.stub(:pagerduty_service_key => payload_service_key) }
|
44
|
+
let(:payload_service_key) { 'payloadfed654cba321' }
|
45
|
+
|
46
|
+
it { should == payload_service_key }
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when the payload class does not respond to service_key' do
|
50
|
+
it { should == default_service_key }
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when the payload class has a nil service_key' do
|
54
|
+
before { payload_class.stub(:pagerduty_service_key => nil) }
|
55
|
+
|
56
|
+
it { should == default_service_key }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when the backend class has no service_key' do
|
61
|
+
context 'when the payload class has a service_key' do
|
62
|
+
before { payload_class.stub(:pagerduty_service_key => payload_service_key) }
|
63
|
+
let(:payload_service_key) { 'payloadfed654cba321' }
|
64
|
+
|
65
|
+
it { should == payload_service_key }
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when the payload class does not respond to service_key' do
|
69
|
+
it { should be_nil }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when the payload class has a nil service_key' do
|
73
|
+
before { payload_class.stub(:pagerduty_service_key => nil) }
|
74
|
+
|
75
|
+
it { should be_nil }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#save' do
|
81
|
+
subject(:save) { backend.save }
|
82
|
+
|
83
|
+
before do
|
84
|
+
stub_request(:any, /.*\.pagerduty\.com.*/).to_return(
|
85
|
+
:status => 200,
|
86
|
+
:headers => {'Content-Type' => 'application/json'},
|
87
|
+
:body => {'status' => 'success',
|
88
|
+
'message' => 'Event processed',
|
89
|
+
'incident_key' => '112358abcdef'}.to_json
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when there is a service key' do
|
94
|
+
before { Resque::Failure::Pagerduty.service_key = service_key }
|
95
|
+
let(:service_key) { 'my_key' }
|
96
|
+
|
97
|
+
it 'should send a post request to the pagerduty api' do
|
98
|
+
save
|
99
|
+
a_request(:post, /.*\.pagerduty\.com/).should have_been_made
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should call the pagerduty api with the correct endpoint' do
|
103
|
+
save
|
104
|
+
a_request(:any, 'https://events.pagerduty.com/generic/2010-04-15/create_event.json').should have_been_made
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should call the pagerduty api with the correct service key' do
|
108
|
+
save
|
109
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"service_key":"#{service_key}"/).should have_been_made
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should call the pagerduty api with the correct event_type' do
|
113
|
+
save
|
114
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"event_type":"trigger"/).should have_been_made
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should call the pagerduty api with the correct description' do
|
118
|
+
save
|
119
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"description":"#{exception.class} in #{payload_class}: #{exception.message}"/).should have_been_made
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should call the pagerduty api with the correct class in the details' do
|
123
|
+
save
|
124
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"payload":\{.*"class":"#{payload_class.name}".*\}.*\}/).should have_been_made
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should call the pagerduty api with the correct args in the details' do
|
128
|
+
save
|
129
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"payload":\{.*"args":\[123\].*\}.*\}/).should have_been_made
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should call the pagerduty api with the correct queue in the details' do
|
133
|
+
save
|
134
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"queue":"#{queue}".*\}/).should have_been_made
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should call the pagerduty api with the correct worker in the details' do
|
138
|
+
save
|
139
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"worker":"#{worker.to_s}".*\}/).should have_been_made
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'should call the pagerduty api with the correct exception class in the details' do
|
143
|
+
save
|
144
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"exception":\{.*"class":"#{exception.class.name}".*\}.*\}/).should have_been_made
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should call the pagerduty api with the correct exception message in the details' do
|
148
|
+
save
|
149
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"exception":\{.*"message":"#{exception.message}".*\}.*\}/).should have_been_made
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'should call the pagerduty api with the correct exception backtrace in the details' do
|
153
|
+
save
|
154
|
+
a_request(:any, /.*\.pagerduty\.com/).with(:body => /"details":\{.*"exception":\{.*"backtrace":\["dummy_file.rb:23","dummy_file.rb:42"\].*\}.*\}/).should have_been_made
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'when there is no service key' do
|
160
|
+
it 'should not attempt to trigger an incident in pagerduty' do
|
161
|
+
save
|
162
|
+
a_request(:any, /.*.pagerduty.com/).should_not have_been_made
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it { should respond_to(:log) }
|
168
|
+
end
|
169
|
+
|
170
|
+
describe 'class methods' do
|
171
|
+
subject { Resque::Failure::Pagerduty }
|
172
|
+
|
173
|
+
describe '.configure' do
|
174
|
+
subject(:configure) do
|
175
|
+
Resque::Failure::Pagerduty.configure do |config|
|
176
|
+
config.service_key = service_key
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
let(:service_key) { 'my_key' }
|
181
|
+
|
182
|
+
it 'should change the service key on the backend class' do
|
183
|
+
expect { configure }.to change { Resque::Failure::Pagerduty.service_key }.to(service_key)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe '.reset' do
|
188
|
+
subject(:reset) { Resque::Failure::Pagerduty.reset }
|
189
|
+
|
190
|
+
before do
|
191
|
+
Resque::Failure::Pagerduty.configure do |config|
|
192
|
+
config.service_key = 'foo'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'should change the service key on the backend class' do
|
197
|
+
expect { reset }.to change { Resque::Failure::Pagerduty.service_key }.to(nil)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
it { should respond_to(:count) }
|
202
|
+
it { should respond_to(:all) }
|
203
|
+
it { should respond_to(:url) }
|
204
|
+
it { should respond_to(:clear) }
|
205
|
+
it { should respond_to(:requeue) }
|
206
|
+
it { should respond_to(:remove) }
|
207
|
+
end
|
208
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque-pagerduty
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Maeve Revels
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-09-21 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 1
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 7
|
30
|
+
version: "1.7"
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
|
+
name: resque
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 19
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 0
|
45
|
+
- 6
|
46
|
+
version: 0.0.6
|
47
|
+
prerelease: false
|
48
|
+
type: :runtime
|
49
|
+
name: redphone
|
50
|
+
requirement: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
prerelease: false
|
62
|
+
type: :development
|
63
|
+
name: rake
|
64
|
+
requirement: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 21
|
72
|
+
segments:
|
73
|
+
- 2
|
74
|
+
- 11
|
75
|
+
version: "2.11"
|
76
|
+
prerelease: false
|
77
|
+
type: :development
|
78
|
+
name: rspec
|
79
|
+
requirement: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
hash: 1
|
87
|
+
segments:
|
88
|
+
- 1
|
89
|
+
- 7
|
90
|
+
version: "1.7"
|
91
|
+
prerelease: false
|
92
|
+
type: :development
|
93
|
+
name: webmock
|
94
|
+
requirement: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 27
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
- 8
|
105
|
+
version: "0.8"
|
106
|
+
prerelease: false
|
107
|
+
type: :development
|
108
|
+
name: yard
|
109
|
+
requirement: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
120
|
+
prerelease: false
|
121
|
+
type: :development
|
122
|
+
name: redcarpet
|
123
|
+
requirement: *id007
|
124
|
+
description: " resque-pagerduty provides a Resque failure backend that triggers a Pagerduty\n incident when an exception is raised by a job.\n"
|
125
|
+
email:
|
126
|
+
- maeve.revels@g5platform.com
|
127
|
+
executables: []
|
128
|
+
|
129
|
+
extensions: []
|
130
|
+
|
131
|
+
extra_rdoc_files: []
|
132
|
+
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- .rspec
|
136
|
+
- .rvmrc
|
137
|
+
- .travis.yml
|
138
|
+
- .yardopts
|
139
|
+
- CHANGELOG.md
|
140
|
+
- Gemfile
|
141
|
+
- LICENSE.md
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- lib/resque/failure/pagerduty.rb
|
145
|
+
- lib/resque_pagerduty.rb
|
146
|
+
- resque-pagerduty.gemspec
|
147
|
+
- spec/resque/failure/pagerduty_spec.rb
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
homepage: http://github.com/maeve/resque-pagerduty
|
150
|
+
licenses: []
|
151
|
+
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
version: "0"
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 3
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
version: "0"
|
175
|
+
requirements: []
|
176
|
+
|
177
|
+
rubyforge_project: resque-pagerduty
|
178
|
+
rubygems_version: 1.8.24
|
179
|
+
signing_key:
|
180
|
+
specification_version: 3
|
181
|
+
summary: A Resque failure backend for Pagerduty
|
182
|
+
test_files:
|
183
|
+
- spec/resque/failure/pagerduty_spec.rb
|
184
|
+
- spec/spec_helper.rb
|
185
|
+
has_rdoc:
|