gesund-mysql 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 +2 -0
- data/Gemfile +5 -0
- data/Rakefile +5 -0
- data/gesund-mysql.gemspec +1 -1
- data/lib/gesund/checks/mysql_connection.rb +3 -6
- data/lib/gesund/mysql.rb +1 -0
- data/lib/gesund/mysql/version.rb +1 -1
- data/spec/lib/gesund/checks/mysql_connection_spec.rb +14 -0
- data/spec/lib/gesund/mysql/version_spec.rb +3 -0
- data/spec/spec_helper.rb +23 -0
- metadata +16 -9
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/gesund-mysql.gemspec
CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "gesund"
|
24
|
+
spec.add_runtime_dependency "gesund", "~> 0.0.3"
|
25
25
|
spec.add_runtime_dependency "mysql"
|
26
26
|
end
|
@@ -3,15 +3,12 @@ require "mysql"
|
|
3
3
|
module Gesund::Checks
|
4
4
|
class MysqlConnection
|
5
5
|
include Gesund::Check
|
6
|
-
def initialize(options)
|
6
|
+
def initialize(options={})
|
7
7
|
begin
|
8
|
-
require 'pp'
|
9
8
|
::Mysql.new.ping.close # raises exception on failure
|
10
|
-
self.
|
11
|
-
self.success = true
|
9
|
+
self.pass "MySQL is answering to a ping"
|
12
10
|
rescue => e
|
13
|
-
self.
|
14
|
-
self.success = false
|
11
|
+
self.fail "#{self.class} ERROR: #{e.class}: #{e.message}"
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
data/lib/gesund/mysql.rb
CHANGED
data/lib/gesund/mysql/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Gesund::Checks::MysqlConnection do
|
4
|
+
it "passes when mysql returns PONG on a ping" do
|
5
|
+
::Mysql.stub_chain(:new, :ping, :close)
|
6
|
+
subject.success.should be_true
|
7
|
+
subject.message.should match "MySQL is answering to a ping"
|
8
|
+
end
|
9
|
+
it "fails when mysql raises an exception" do
|
10
|
+
::Mysql.stub(:new).and_raise("something bad")
|
11
|
+
subject.success.should be_false
|
12
|
+
subject.message.should match "MysqlConnection ERROR: RuntimeError: something bad"
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "simplecov"
|
3
|
+
require File.expand_path "../../lib/gesund/mysql", __FILE__
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
7
|
+
# loaded once.
|
8
|
+
#
|
9
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter 'bundle'
|
12
|
+
end
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
|
+
config.run_all_when_everything_filtered = true
|
16
|
+
config.filter_run :focus
|
17
|
+
|
18
|
+
# Run specs in random order to surface order dependencies. If you find an
|
19
|
+
# order dependency and want to debug it, you can fix the order by providing
|
20
|
+
# the seed, which is printed after each run.
|
21
|
+
# --seed 1234
|
22
|
+
config.order = 'random'
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gesund-mysql
|
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
|
@@ -48,17 +48,17 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 0.0.3
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.0.3
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: mysql
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +83,7 @@ extensions: []
|
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
|
+
- .rspec
|
86
87
|
- Gemfile
|
87
88
|
- LICENSE.txt
|
88
89
|
- README.md
|
@@ -91,6 +92,9 @@ files:
|
|
91
92
|
- lib/gesund/checks/mysql_connection.rb
|
92
93
|
- lib/gesund/mysql.rb
|
93
94
|
- lib/gesund/mysql/version.rb
|
95
|
+
- spec/lib/gesund/checks/mysql_connection_spec.rb
|
96
|
+
- spec/lib/gesund/mysql/version_spec.rb
|
97
|
+
- spec/spec_helper.rb
|
94
98
|
homepage: ''
|
95
99
|
licenses:
|
96
100
|
- MIT
|
@@ -106,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
110
|
version: '0'
|
107
111
|
segments:
|
108
112
|
- 0
|
109
|
-
hash:
|
113
|
+
hash: 1854851455280915611
|
110
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
115
|
none: false
|
112
116
|
requirements:
|
@@ -115,11 +119,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
119
|
version: '0'
|
116
120
|
segments:
|
117
121
|
- 0
|
118
|
-
hash:
|
122
|
+
hash: 1854851455280915611
|
119
123
|
requirements: []
|
120
124
|
rubyforge_project:
|
121
125
|
rubygems_version: 1.8.25
|
122
126
|
signing_key:
|
123
127
|
specification_version: 3
|
124
128
|
summary: MySQL health checks for Gesund
|
125
|
-
test_files:
|
129
|
+
test_files:
|
130
|
+
- spec/lib/gesund/checks/mysql_connection_spec.rb
|
131
|
+
- spec/lib/gesund/mysql/version_spec.rb
|
132
|
+
- spec/spec_helper.rb
|