gesund-mongo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -1
- data/Gemfile +5 -0
- data/Gemfile.lock +9 -3
- data/gesund-mongo.gemspec +1 -2
- data/lib/gesund/checks/mongo_connection.rb +7 -6
- data/lib/gesund/mongo/version.rb +1 -1
- data/lib/gesund/mongo.rb +1 -0
- data/spec/lib/gesund/checks/mongo_connection_spec.rb +19 -0
- data/spec/lib/gesund/mongo/version_spec.rb +3 -0
- data/spec/spec_helper.rb +4 -0
- metadata +12 -24
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format documentation
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gesund-mongo (0.0.
|
4
|
+
gesund-mongo (0.0.2)
|
5
5
|
bson_ext
|
6
|
-
gesund
|
6
|
+
gesund (~> 0.0.3)
|
7
7
|
mongo
|
8
8
|
|
9
9
|
GEM
|
@@ -13,11 +13,12 @@ GEM
|
|
13
13
|
bson_ext (1.8.5)
|
14
14
|
bson (~> 1.8.5)
|
15
15
|
diff-lcs (1.2.4)
|
16
|
-
gesund (0.0.
|
16
|
+
gesund (0.0.3)
|
17
17
|
rack
|
18
18
|
thor
|
19
19
|
mongo (1.8.5)
|
20
20
|
bson (~> 1.8.5)
|
21
|
+
multi_json (1.7.2)
|
21
22
|
rack (1.5.2)
|
22
23
|
rake (10.0.4)
|
23
24
|
rspec (2.13.0)
|
@@ -28,6 +29,10 @@ GEM
|
|
28
29
|
rspec-expectations (2.13.0)
|
29
30
|
diff-lcs (>= 1.1.3, < 2.0)
|
30
31
|
rspec-mocks (2.13.1)
|
32
|
+
simplecov (0.7.1)
|
33
|
+
multi_json (~> 1.0)
|
34
|
+
simplecov-html (~> 0.7.1)
|
35
|
+
simplecov-html (0.7.1)
|
31
36
|
thor (0.18.1)
|
32
37
|
|
33
38
|
PLATFORMS
|
@@ -38,3 +43,4 @@ DEPENDENCIES
|
|
38
43
|
gesund-mongo!
|
39
44
|
rake
|
40
45
|
rspec
|
46
|
+
simplecov
|
data/gesund-mongo.gemspec
CHANGED
@@ -20,9 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
23
|
|
25
|
-
spec.add_runtime_dependency "gesund"
|
24
|
+
spec.add_runtime_dependency "gesund", "~> 0.0.3"
|
26
25
|
spec.add_runtime_dependency "mongo"
|
27
26
|
spec.add_runtime_dependency "bson_ext"
|
28
27
|
end
|
@@ -3,14 +3,15 @@ require "mongo"
|
|
3
3
|
module Gesund::Checks
|
4
4
|
class MongoConnection
|
5
5
|
include Gesund::Check
|
6
|
-
|
7
|
-
def initialize(options)
|
6
|
+
def initialize(options={})
|
8
7
|
begin
|
9
|
-
|
10
|
-
|
8
|
+
if ::Mongo::MongoClient.new(options).ping.keys.first == "ok"
|
9
|
+
self.pass "Mongo PING = OK"
|
10
|
+
else
|
11
|
+
self.fail "Mongo PING != OK"
|
12
|
+
end
|
11
13
|
rescue => e
|
12
|
-
self.
|
13
|
-
self.success = false
|
14
|
+
self.fail "#{self.class} ERROR: #{e.class}: #{e.message}"
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/gesund/mongo/version.rb
CHANGED
data/lib/gesund/mongo.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Gesund::Checks::MongoConnection do
|
4
|
+
it "passes when mongo returns {ok} on a ping" do
|
5
|
+
Mongo::MongoClient.stub_chain(:new, :ping).and_return({"ok"=>1})
|
6
|
+
subject.success.should be_true
|
7
|
+
subject.message.should match "Mongo PING = OK"
|
8
|
+
end
|
9
|
+
it "fails when mongo returns not-{ok} on a ping" do
|
10
|
+
Mongo::MongoClient.stub_chain(:new, :ping).and_return({"fail"=>1})
|
11
|
+
subject.success.should be_false
|
12
|
+
subject.message.should match "Mongo PING != OK"
|
13
|
+
end
|
14
|
+
it "fails when mongo raises an exception" do
|
15
|
+
Mongo::MongoClient.stub(:new).and_raise("something bad")
|
16
|
+
subject.success.should be_false
|
17
|
+
subject.message.should match "MongoConnection ERROR: RuntimeError: something bad"
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bundler/setup"
|
2
|
+
require "simplecov"
|
2
3
|
require File.expand_path "../../lib/gesund/mongo", __FILE__
|
3
4
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
5
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -6,6 +7,9 @@ require File.expand_path "../../lib/gesund/mongo", __FILE__
|
|
6
7
|
# loaded once.
|
7
8
|
#
|
8
9
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter 'bundle'
|
12
|
+
end
|
9
13
|
RSpec.configure do |config|
|
10
14
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
15
|
config.run_all_when_everything_filtered = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gesund-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -43,38 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rspec
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
47
|
name: gesund
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
65
49
|
none: false
|
66
50
|
requirements:
|
67
|
-
- -
|
51
|
+
- - ~>
|
68
52
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
53
|
+
version: 0.0.3
|
70
54
|
type: :runtime
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
|
-
- -
|
59
|
+
- - ~>
|
76
60
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
61
|
+
version: 0.0.3
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
63
|
name: mongo
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +110,8 @@ files:
|
|
126
110
|
- lib/gesund/checks/mongo_connection.rb
|
127
111
|
- lib/gesund/mongo.rb
|
128
112
|
- lib/gesund/mongo/version.rb
|
113
|
+
- spec/lib/gesund/checks/mongo_connection_spec.rb
|
114
|
+
- spec/lib/gesund/mongo/version_spec.rb
|
129
115
|
- spec/spec_helper.rb
|
130
116
|
homepage: ''
|
131
117
|
licenses:
|
@@ -142,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
128
|
version: '0'
|
143
129
|
segments:
|
144
130
|
- 0
|
145
|
-
hash:
|
131
|
+
hash: -4478070896340562954
|
146
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
133
|
none: false
|
148
134
|
requirements:
|
@@ -151,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
137
|
version: '0'
|
152
138
|
segments:
|
153
139
|
- 0
|
154
|
-
hash:
|
140
|
+
hash: -4478070896340562954
|
155
141
|
requirements: []
|
156
142
|
rubyforge_project:
|
157
143
|
rubygems_version: 1.8.25
|
@@ -159,4 +145,6 @@ signing_key:
|
|
159
145
|
specification_version: 3
|
160
146
|
summary: MongoDB health checks for Gesund
|
161
147
|
test_files:
|
148
|
+
- spec/lib/gesund/checks/mongo_connection_spec.rb
|
149
|
+
- spec/lib/gesund/mongo/version_spec.rb
|
162
150
|
- spec/spec_helper.rb
|