heartcheck-resque 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/{.ruby-version → .ruby-version.sample} +0 -0
- data/.travis.yml +17 -0
- data/Gemfile +1 -1
- data/Gemfile-old-ruby +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +10 -4
- data/Rakefile +1 -2
- data/bin/console +10 -0
- data/bin/rspec +18 -0
- data/bin/rubocop +18 -0
- data/bin/setup +7 -0
- data/heartcheck-resque.gemspec +11 -11
- data/lib/heartcheck/resque/version.rb +1 -1
- data/spec/heartcheck/checks/resque_spec.rb +24 -8
- data/spec/spec_helper.rb +1 -0
- metadata +16 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0453bb7009f774195c59c9527a2139569f9cd8f7
|
4
|
+
data.tar.gz: 39141561116747a4faecb580cbecce5d750ebb4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d069dd5c57a53ed234f8ad0182de9e63e61e1101f9832fc2a5a33b9bffdf3cfa6681915a80bcaf8c5712c055824781c7e02335105b0d8d7e5ba6d5e9fe76c5af
|
7
|
+
data.tar.gz: 7d5545c840c74c5602c873cd516b08bd40b329fe031418ed4cb92edeb48c8088cda153388b2a178da7e11a436c516f544343a5c97eeb128e837ea1682138d765
|
data/.gitignore
CHANGED
data/.rspec
ADDED
File without changes
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
services:
|
3
|
+
- redis-server
|
4
|
+
before_install: gem install bundler -v 1.10.6
|
5
|
+
install: bundle install -j 4 --retry 3
|
6
|
+
script:
|
7
|
+
- bin/rspec
|
8
|
+
|
9
|
+
matrix:
|
10
|
+
include:
|
11
|
+
- rvm: "1.9.3"
|
12
|
+
gemfile: Gemfile-old-ruby
|
13
|
+
- rvm: "2.0.0"
|
14
|
+
- rvm: "2.1.7"
|
15
|
+
- rvm: "2.2.4"
|
16
|
+
- rvm: "2.3.0"
|
17
|
+
- rvm: "2.4.0"
|
data/Gemfile
CHANGED
data/Gemfile-old-ruby
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# Heartcheck::Resque
|
2
2
|
|
3
3
|
[](https://travis-ci.org/locaweb/heartcheck-resque)
|
4
|
+
[](https://codeclimate.com/github/locaweb/heartcheck-resque)
|
4
5
|
|
5
|
-
A plugin to check resque connection with heartcheck
|
6
|
+
##A plugin to check resque connection and error amount with [heartcheck](https://github.com/locaweb/heartcheck).
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
10
|
Add this line to your application's Gemfile:
|
10
11
|
|
11
12
|
```ruby
|
12
|
-
gem 'heartcheck
|
13
|
+
gem 'heartcheck/resque'
|
13
14
|
```
|
14
15
|
|
15
16
|
And then execute:
|
@@ -22,16 +23,21 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
You can
|
26
|
+
You can check any resque connection that there's in your app.
|
26
27
|
|
27
28
|
```ruby
|
28
29
|
Heartcheck.setup do |config|
|
29
30
|
config.add :resque do |c|
|
30
|
-
c.
|
31
|
+
c.add_service(failures_limit: 10)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
```
|
34
35
|
|
36
|
+
### Check Heartcheck example [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb)
|
37
|
+
|
38
|
+
## License
|
39
|
+
* [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt)
|
40
|
+
|
35
41
|
## Contributing
|
36
42
|
|
37
43
|
1. Fork it ( https://github.com/locaweb/heartcheck-resque/fork )
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'heartcheck/resque'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
require 'pry'
|
10
|
+
Pry.start
|
data/bin/rspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
11
|
+
'../../Gemfile',
|
12
|
+
Pathname.new(__FILE__).realpath
|
13
|
+
)
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'bundler/setup'
|
17
|
+
|
18
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/rubocop
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rubocop' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
11
|
+
'../../Gemfile',
|
12
|
+
Pathname.new(__FILE__).realpath
|
13
|
+
)
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'bundler/setup'
|
17
|
+
|
18
|
+
load Gem.bin_path('rubocop', 'rubocop')
|
data/bin/setup
ADDED
data/heartcheck-resque.gemspec
CHANGED
@@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'heartcheck/resque/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'heartcheck-resque'
|
8
8
|
spec.version = Heartcheck::Resque::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Locaweb']
|
10
|
+
spec.email = ['desenvolvedores@locaweb.com.br']
|
11
11
|
spec.summary = 'A resque failures checker'
|
12
12
|
spec.description = 'Plugin to check resque failures'
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'http://developer.locaweb.com.br'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.
|
18
|
-
spec.
|
19
|
-
spec.
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(/^exe/) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)/)
|
20
|
+
spec.require_paths = ['lib']
|
20
21
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency 'rspec', '~> 3.1.0', '>= 3.1.0'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
23
23
|
spec.add_development_dependency 'rubocop', '~> 0.27.0', '>= 0.27.1'
|
24
24
|
spec.add_development_dependency 'pry-nav', '~> 0.2.0', '>= 0.2.4'
|
25
25
|
|
26
|
-
spec.add_dependency 'heartcheck', '~> 1.0
|
26
|
+
spec.add_dependency 'heartcheck', '~> 1.0', '>= 1.0.0'
|
27
27
|
spec.add_dependency 'resque', '~> 1.0'
|
28
28
|
end
|
@@ -1,16 +1,20 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe Heartcheck::Checks::Resque do
|
2
|
+
subject(:check) { described_class.new.tap { |c| c.add_service(opts) } }
|
3
|
+
|
4
4
|
let(:opts) { { failures_limit: 0 } }
|
5
|
-
subject { described_class.new.tap { |c| c.add_service(opts) } }
|
6
5
|
|
7
6
|
describe '#validate' do
|
8
|
-
|
7
|
+
subject(:validate!) { check.validate }
|
8
|
+
|
9
|
+
let(:errors) { -> { check.instance_variable_get(:@errors) } }
|
10
|
+
|
11
|
+
context 'with any error on Resque\'s failed jobs' do
|
9
12
|
before { allow(Resque::Failure).to receive(:count).and_return(2) }
|
10
13
|
|
11
14
|
it 'sets @error' do
|
12
|
-
|
13
|
-
|
15
|
+
expect { validate! }.to change(&errors)
|
16
|
+
.from([])
|
17
|
+
.to(['Resque failed! 2 failures'])
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -18,8 +22,20 @@ describe Heartcheck::Checks::Resque do
|
|
18
22
|
before { expect(Resque::Failure).to receive(:count).and_return(0) }
|
19
23
|
|
20
24
|
it 'has no errors' do
|
21
|
-
|
22
|
-
|
25
|
+
expect { validate! }.to_not change(&errors).from([])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
context 'with an unexpected error' do
|
31
|
+
before do
|
32
|
+
allow(Resque::Failure).to receive(:count).and_raise('AnError')
|
33
|
+
end
|
34
|
+
|
35
|
+
it do
|
36
|
+
expect { validate! }.to change(&errors)
|
37
|
+
.from([])
|
38
|
+
.to(['Resque failed! AnError'])
|
23
39
|
end
|
24
40
|
end
|
25
41
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartcheck-resque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Locaweb
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.7'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.7'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 3.1.0
|
19
|
+
version: 3.4.0
|
37
20
|
type: :development
|
38
21
|
prerelease: false
|
39
22
|
version_requirements: !ruby/object:Gem::Requirement
|
40
23
|
requirements:
|
41
24
|
- - "~>"
|
42
25
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 3.1.0
|
26
|
+
version: 3.4.0
|
47
27
|
- !ruby/object:Gem::Dependency
|
48
28
|
name: rubocop
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,7 +70,7 @@ dependencies:
|
|
90
70
|
requirements:
|
91
71
|
- - "~>"
|
92
72
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.0
|
73
|
+
version: '1.0'
|
94
74
|
- - ">="
|
95
75
|
- !ruby/object:Gem::Version
|
96
76
|
version: 1.0.0
|
@@ -100,7 +80,7 @@ dependencies:
|
|
100
80
|
requirements:
|
101
81
|
- - "~>"
|
102
82
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
83
|
+
version: '1.0'
|
104
84
|
- - ">="
|
105
85
|
- !ruby/object:Gem::Version
|
106
86
|
version: 1.0.0
|
@@ -126,11 +106,18 @@ extensions: []
|
|
126
106
|
extra_rdoc_files: []
|
127
107
|
files:
|
128
108
|
- ".gitignore"
|
129
|
-
- ".
|
109
|
+
- ".rspec"
|
110
|
+
- ".ruby-version.sample"
|
111
|
+
- ".travis.yml"
|
130
112
|
- Gemfile
|
113
|
+
- Gemfile-old-ruby
|
131
114
|
- LICENSE.txt
|
132
115
|
- README.md
|
133
116
|
- Rakefile
|
117
|
+
- bin/console
|
118
|
+
- bin/rspec
|
119
|
+
- bin/rubocop
|
120
|
+
- bin/setup
|
134
121
|
- heartcheck-resque.gemspec
|
135
122
|
- lib/heartcheck/checks/resque.rb
|
136
123
|
- lib/heartcheck/resque.rb
|
@@ -157,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
144
|
version: '0'
|
158
145
|
requirements: []
|
159
146
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.2
|
147
|
+
rubygems_version: 2.5.2
|
161
148
|
signing_key:
|
162
149
|
specification_version: 4
|
163
150
|
summary: A resque failures checker
|