litmus_paper 0.6.2 → 0.6.3
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.
- data/lib/litmus_paper.rb +11 -16
- data/lib/litmus_paper/cli/admin.rb +2 -1
- data/lib/litmus_paper/cli/admin/command.rb +3 -6
- data/lib/litmus_paper/cli/server.rb +3 -8
- data/lib/litmus_paper/configuration.rb +1 -27
- data/lib/litmus_paper/configuration_file.rb +40 -0
- data/lib/litmus_paper/dependency/haproxy_backends.rb +10 -7
- data/lib/litmus_paper/dependency/tcp.rb +2 -1
- data/lib/litmus_paper/logger.rb +1 -1
- data/lib/litmus_paper/status_file.rb +1 -1
- data/lib/litmus_paper/version.rb +1 -1
- data/spec/litmus_paper/app_spec.rb +4 -0
- data/spec/litmus_paper/cli/admin_spec.rb +2 -2
- data/spec/litmus_paper/cli/server_spec.rb +0 -5
- data/spec/litmus_paper/configuration_file_spec.rb +39 -0
- data/spec/litmus_paper_spec.rb +23 -7
- data/spec/spec_helper.rb +7 -8
- data/spec/support/test.config +4 -0
- metadata +123 -103
- data/spec/litmus_paper/configuration_spec.rb +0 -19
data/lib/litmus_paper.rb
CHANGED
@@ -22,6 +22,7 @@ require 'facts/loadaverage'
|
|
22
22
|
|
23
23
|
require 'litmus_paper/app'
|
24
24
|
require 'litmus_paper/configuration'
|
25
|
+
require 'litmus_paper/configuration_file'
|
25
26
|
require 'litmus_paper/dependency/haproxy_backends'
|
26
27
|
require 'litmus_paper/dependency/http'
|
27
28
|
require 'litmus_paper/dependency/tcp'
|
@@ -37,7 +38,8 @@ require 'litmus_paper/version'
|
|
37
38
|
|
38
39
|
module LitmusPaper
|
39
40
|
class << self
|
40
|
-
|
41
|
+
extend Forwardable
|
42
|
+
def_delegators :@config, :services, :data_directory, :port
|
41
43
|
attr_accessor :logger
|
42
44
|
end
|
43
45
|
|
@@ -46,7 +48,7 @@ module LitmusPaper
|
|
46
48
|
def self.check_service(service_name)
|
47
49
|
Facter.flush
|
48
50
|
|
49
|
-
if service =
|
51
|
+
if service = services[service_name]
|
50
52
|
service.current_health
|
51
53
|
else
|
52
54
|
nil
|
@@ -55,24 +57,17 @@ module LitmusPaper
|
|
55
57
|
|
56
58
|
def self.configure(filename)
|
57
59
|
@config_file = filename
|
58
|
-
|
59
|
-
begin
|
60
|
-
@services = LitmusPaper::Configuration.new(filename).evaluate
|
61
|
-
rescue Exception
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.config_dir=(path)
|
66
|
-
@config_dir = Pathname.new(path)
|
60
|
+
@config = LitmusPaper::ConfigurationFile.new(filename).evaluate
|
67
61
|
end
|
68
62
|
|
69
63
|
def self.reload
|
70
64
|
LitmusPaper.logger.info "Reloading configuration"
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
begin
|
66
|
+
configure(@config_file)
|
67
|
+
rescue Exception => e
|
68
|
+
LitmusPaper.logger.error "Problem reloading config: #{e.message}"
|
69
|
+
LitmusPaper.logger.error e.backtrace.join("\n")
|
70
|
+
end
|
76
71
|
end
|
77
72
|
end
|
78
73
|
|
@@ -15,7 +15,8 @@ module LitmusPaper
|
|
15
15
|
if command = Admin.commands[command_name]
|
16
16
|
options = {}
|
17
17
|
request = command.build_request(options, argv)
|
18
|
-
|
18
|
+
LitmusPaper.configure(options[:litmus_config])
|
19
|
+
_litmus_request('127.0.0.1', LitmusPaper.port, request)
|
19
20
|
else
|
20
21
|
_display_help
|
21
22
|
end
|
@@ -3,18 +3,15 @@ module LitmusPaper
|
|
3
3
|
class Admin
|
4
4
|
class Command
|
5
5
|
def self._default_options
|
6
|
-
options = { :
|
6
|
+
options = { :litmus_config => "/etc/litmus.conf" }
|
7
7
|
end
|
8
8
|
|
9
9
|
def self._extend_default_parser(options, &block)
|
10
10
|
OptionParser.new do |opts|
|
11
11
|
block.call(opts)
|
12
12
|
|
13
|
-
opts.on("-
|
14
|
-
options[:
|
15
|
-
end
|
16
|
-
opts.on("-h", "--host=ip", String, ":Host litmus is running on", "Default: localhost") do |host|
|
17
|
-
options[:host] = host
|
13
|
+
opts.on("-c", "--config=file", String, "Litmus configuration file", "Default: /etc/litmus.conf") do |config|
|
14
|
+
options[:litmus_config] = config
|
18
15
|
end
|
19
16
|
opts.on("--help", "Show this help message.") { puts opts; exit }
|
20
17
|
end
|
@@ -9,13 +9,8 @@ module LitmusPaper
|
|
9
9
|
opts.banner = "Usage: litmus [mongrel, thin, etc] [options]"
|
10
10
|
opts.on("-c", "--config=file", String,
|
11
11
|
"Litmus configuration file", "Default: /etc/litmus.conf") { |v| options[:litmus_config] = v }
|
12
|
-
opts.on("-D", "--data-dir=path", String,
|
13
|
-
"Litmus data directory", "Default: /etc/litmus") { |v| options[:config_dir] = v }
|
14
|
-
|
15
12
|
opts.separator ""
|
16
13
|
|
17
|
-
opts.on("-p", "--port=port", Integer,
|
18
|
-
"Runs Litmus on the specified port.", "Default: 9292") { |v| options[:Port] = v }
|
19
14
|
opts.on("-b", "--binding=ip", String,
|
20
15
|
"Binds Litmus to the specified ip.", "Default: 0.0.0.0") { |v| options[:Host] = v }
|
21
16
|
opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:daemonize] = true }
|
@@ -47,14 +42,14 @@ module LitmusPaper
|
|
47
42
|
end
|
48
43
|
|
49
44
|
LitmusPaper.configure(options[:litmus_config])
|
50
|
-
|
45
|
+
options[:Port] = LitmusPaper.port
|
46
|
+
|
51
47
|
super
|
52
48
|
end
|
53
49
|
|
54
50
|
def default_options
|
55
51
|
super.merge(
|
56
|
-
:litmus_config => '/etc/litmus.conf'
|
57
|
-
:config_dir => '/etc/litmus'
|
52
|
+
:litmus_config => '/etc/litmus.conf'
|
58
53
|
)
|
59
54
|
end
|
60
55
|
end
|
@@ -1,30 +1,4 @@
|
|
1
1
|
module LitmusPaper
|
2
|
-
class Configuration
|
3
|
-
def initialize(config_file_path)
|
4
|
-
@config_file_path = config_file_path
|
5
|
-
@services = {}
|
6
|
-
end
|
7
|
-
|
8
|
-
def evaluate(file = @config_file_path)
|
9
|
-
LitmusPaper.logger.info "Loading file #{file}"
|
10
|
-
config_contents = File.read(file)
|
11
|
-
instance_eval(config_contents)
|
12
|
-
@services
|
13
|
-
end
|
14
|
-
|
15
|
-
def include_files(glob_pattern)
|
16
|
-
full_glob_pattern = File.expand_path(glob_pattern, File.dirname(@config_file_path))
|
17
|
-
LitmusPaper.logger.info "Searching for files matching: #{full_glob_pattern}"
|
18
|
-
|
19
|
-
Dir.glob(full_glob_pattern).each do |file|
|
20
|
-
evaluate(file)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def service(name, &block)
|
25
|
-
service = Service.new(name.to_s)
|
26
|
-
block.call(service)
|
27
|
-
@services[name.to_s] = service
|
28
|
-
end
|
2
|
+
class Configuration < Struct.new(:port, :data_directory, :services)
|
29
3
|
end
|
30
4
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module LitmusPaper
|
2
|
+
class ConfigurationFile
|
3
|
+
def initialize(config_file_path)
|
4
|
+
@config_file_path = config_file_path
|
5
|
+
@services = {}
|
6
|
+
@port = 9292
|
7
|
+
@data_directory = "/etc/litmus"
|
8
|
+
end
|
9
|
+
|
10
|
+
def evaluate(file = @config_file_path)
|
11
|
+
LitmusPaper.logger.info "Loading file #{file}"
|
12
|
+
config_contents = File.read(file)
|
13
|
+
instance_eval(config_contents)
|
14
|
+
LitmusPaper::Configuration.new(@port, @data_directory, @services)
|
15
|
+
end
|
16
|
+
|
17
|
+
def include_files(glob_pattern)
|
18
|
+
full_glob_pattern = File.expand_path(glob_pattern, File.dirname(@config_file_path))
|
19
|
+
LitmusPaper.logger.info "Searching for files matching: #{full_glob_pattern}"
|
20
|
+
|
21
|
+
Dir.glob(full_glob_pattern).each do |file|
|
22
|
+
evaluate(file)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def port(port)
|
27
|
+
@port = port
|
28
|
+
end
|
29
|
+
|
30
|
+
def data_directory(directory)
|
31
|
+
@data_directory = directory
|
32
|
+
end
|
33
|
+
|
34
|
+
def service(name, &block)
|
35
|
+
service = Service.new(name.to_s)
|
36
|
+
block.call(service)
|
37
|
+
@services[name.to_s] = service
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -11,12 +11,15 @@ module LitmusPaper
|
|
11
11
|
|
12
12
|
def available?
|
13
13
|
stats = _parse_stats(_fetch_stats)
|
14
|
+
backend = _find_backend(stats, @cluster)
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if backend['status'] != 'UP'
|
17
|
+
LitmusPaper.logger.info("HAproxy available check failed, #{@cluster} backend is #{backend['status']}")
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
return true
|
19
21
|
rescue Timeout::Error
|
22
|
+
LitmusPaper.logger.info("HAproxy available check timed out for #{@cluster}")
|
20
23
|
false
|
21
24
|
end
|
22
25
|
|
@@ -24,9 +27,9 @@ module LitmusPaper
|
|
24
27
|
"Dependency::HaproxyBackends(#{@domain_socket}, #{@cluster})"
|
25
28
|
end
|
26
29
|
|
27
|
-
def
|
28
|
-
stats.
|
29
|
-
line['# pxname'] == cluster &&
|
30
|
+
def _find_backend(stats, cluster)
|
31
|
+
stats.detect do |line|
|
32
|
+
line['# pxname'] == cluster && line['svname'] == 'BACKEND'
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
data/lib/litmus_paper/logger.rb
CHANGED
data/lib/litmus_paper/version.rb
CHANGED
@@ -5,6 +5,10 @@ describe LitmusPaper::App do
|
|
5
5
|
LitmusPaper::App
|
6
6
|
end
|
7
7
|
|
8
|
+
before :each do
|
9
|
+
LitmusPaper.configure(TEST_CONFIG)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe "GET /" do
|
9
13
|
it "returns the list of services litmus monitors" do
|
10
14
|
LitmusPaper.services['test'] = LitmusPaper::Service.new('test')
|
@@ -3,11 +3,11 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe 'litmusctl' do
|
5
5
|
def _litmusctl(args)
|
6
|
-
`bundle exec ruby -I lib bin/litmusctl #{args} -
|
6
|
+
`bundle exec ruby -I lib bin/litmusctl #{args} -c #{TEST_CONFIG}`
|
7
7
|
end
|
8
8
|
|
9
9
|
before(:all) do
|
10
|
-
system "bundle exec ruby -I lib bin/litmus -
|
10
|
+
system "bundle exec ruby -I lib bin/litmus -d -c #{TEST_CONFIG} -P /tmp/litmus.pid"
|
11
11
|
end
|
12
12
|
|
13
13
|
after(:all) do
|
@@ -7,10 +7,5 @@ describe LitmusPaper::CLI::Server do
|
|
7
7
|
options = LitmusPaper::CLI::Server::Options.new.parse!(['-c', 'foo.conf'])
|
8
8
|
options[:litmus_config].should == 'foo.conf'
|
9
9
|
end
|
10
|
-
|
11
|
-
it 'parses the config dir options' do
|
12
|
-
options = LitmusPaper::CLI::Server::Options.new.parse!(['-D', '/tmp/foo'])
|
13
|
-
options[:config_dir].should == '/tmp/foo'
|
14
|
-
end
|
15
10
|
end
|
16
11
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LitmusPaper::ConfigurationFile do
|
4
|
+
describe "evaluate" do
|
5
|
+
it "configures a service" do
|
6
|
+
config_file = LitmusPaper::ConfigurationFile.new(TEST_CONFIG)
|
7
|
+
config = config_file.evaluate
|
8
|
+
config.services.has_key?('test').should == true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "configures the port to listen on" do
|
12
|
+
config_file = LitmusPaper::ConfigurationFile.new(TEST_CONFIG)
|
13
|
+
config = config_file.evaluate
|
14
|
+
config.port.should == 9293
|
15
|
+
end
|
16
|
+
|
17
|
+
it "configures the data directory" do
|
18
|
+
config_file = LitmusPaper::ConfigurationFile.new(TEST_CONFIG)
|
19
|
+
config = config_file.evaluate
|
20
|
+
config.data_directory.should == "/tmp/litmus_paper"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "include_files" do
|
25
|
+
it "configures a dir glob of services" do
|
26
|
+
config_file = LitmusPaper::ConfigurationFile.new(TEST_D_CONFIG)
|
27
|
+
config = config_file.evaluate
|
28
|
+
config.services.has_key?('test').should == true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "defaults configuration options" do
|
32
|
+
config_file = LitmusPaper::ConfigurationFile.new(TEST_D_CONFIG)
|
33
|
+
config = config_file.evaluate
|
34
|
+
config.services.has_key?('test').should == true
|
35
|
+
config.port.should == 9292
|
36
|
+
config.data_directory.should == "/etc/litmus"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/litmus_paper_spec.rb
CHANGED
@@ -32,20 +32,36 @@ describe LitmusPaper do
|
|
32
32
|
LitmusPaper.services.has_key?('test').should == true
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
36
|
-
|
35
|
+
it "blows up when initial configuration is invalid" do
|
36
|
+
bad_config_file = SpecHelper.create_temp_file(<<-END)
|
37
37
|
service :old_service do |s|
|
38
|
-
|
38
|
+
syntax error here
|
39
39
|
end
|
40
40
|
END
|
41
|
-
|
41
|
+
expect do
|
42
|
+
LitmusPaper.configure(bad_config_file)
|
43
|
+
end.should raise_error
|
44
|
+
end
|
45
|
+
|
46
|
+
it "keeps the old config if there are errors in the new config" do
|
47
|
+
config_file = SpecHelper.create_temp_file(<<-END)
|
42
48
|
service :old_service do |s|
|
43
|
-
|
49
|
+
s.measure_health Metric::CPULoad, :weight => 100
|
44
50
|
end
|
45
51
|
END
|
46
|
-
|
52
|
+
|
53
|
+
LitmusPaper.configure(config_file)
|
47
54
|
LitmusPaper.services.keys.should == ["old_service"]
|
48
|
-
|
55
|
+
|
56
|
+
File.open(config_file, "w") do |file|
|
57
|
+
file.write(<<-END)
|
58
|
+
service :old_service do |s|
|
59
|
+
syntax error here
|
60
|
+
end
|
61
|
+
END
|
62
|
+
end
|
63
|
+
|
64
|
+
LitmusPaper.reload
|
49
65
|
LitmusPaper.services.keys.should == ["old_service"]
|
50
66
|
end
|
51
67
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,11 @@ require 'rack/test'
|
|
5
5
|
require 'litmus_paper'
|
6
6
|
require 'tempfile'
|
7
7
|
|
8
|
+
TEST_CONFIG_DIR = "/tmp/litmus_paper"
|
9
|
+
TEST_CONFIG = File.expand_path('support/test.config', File.dirname(__FILE__))
|
10
|
+
TEST_D_CONFIG = File.expand_path('support/test.d.config', File.dirname(__FILE__))
|
11
|
+
TEST_CA_CERT = File.expand_path('ssl/server.crt', File.dirname(__FILE__))
|
12
|
+
|
8
13
|
Dir.glob("#{File.expand_path('support', File.dirname(__FILE__))}/**/*.rb").each { |f| require f }
|
9
14
|
|
10
15
|
RSpec.configure do |config|
|
@@ -12,8 +17,8 @@ RSpec.configure do |config|
|
|
12
17
|
config.include Rack::Test::Methods
|
13
18
|
|
14
19
|
config.before :each do
|
15
|
-
FileUtils.rm_rf
|
16
|
-
LitmusPaper.
|
20
|
+
FileUtils.rm_rf TEST_CONFIG_DIR
|
21
|
+
LitmusPaper.stub(:data_directory).and_return(TEST_CONFIG_DIR)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
@@ -39,9 +44,3 @@ module SpecHelper
|
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
42
|
-
|
43
|
-
LitmusPaper.config_dir = "/tmp/litmus_paper"
|
44
|
-
|
45
|
-
TEST_CONFIG = File.expand_path('support/test.config', File.dirname(__FILE__))
|
46
|
-
TEST_D_CONFIG = File.expand_path('support/test.d.config', File.dirname(__FILE__))
|
47
|
-
TEST_CA_CERT = File.expand_path('ssl/server.crt', File.dirname(__FILE__))
|
data/spec/support/test.config
CHANGED
metadata
CHANGED
@@ -1,137 +1,146 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: litmus_paper
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Braintreeps
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-11-07 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: sinatra
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.3.2
|
22
|
-
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
|
-
requirements:
|
26
|
+
requirements:
|
27
27
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 2
|
29
34
|
version: 1.3.2
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: facter
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.6.7
|
38
35
|
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: facter
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
|
-
requirements:
|
42
|
+
requirements:
|
43
43
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 1
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 6
|
49
|
+
- 7
|
45
50
|
version: 1.6.7
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: SyslogLogger
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.4.1
|
54
51
|
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: SyslogLogger
|
55
55
|
prerelease: false
|
56
|
-
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
|
-
requirements:
|
58
|
+
requirements:
|
59
59
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 5
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 4
|
65
|
+
- 1
|
61
66
|
version: 1.4.1
|
62
|
-
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
63
70
|
name: rspec
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.9.0
|
70
|
-
type: :development
|
71
71
|
prerelease: false
|
72
|
-
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
|
-
requirements:
|
74
|
+
requirements:
|
75
75
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 43
|
78
|
+
segments:
|
79
|
+
- 2
|
80
|
+
- 9
|
81
|
+
- 0
|
77
82
|
version: 2.9.0
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rack-test
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 0.6.1
|
86
83
|
type: :development
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rack-test
|
87
87
|
prerelease: false
|
88
|
-
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
|
-
requirements:
|
90
|
+
requirements:
|
91
91
|
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 5
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
- 6
|
97
|
+
- 1
|
93
98
|
version: 0.6.1
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.9.2.2
|
102
99
|
type: :development
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rake
|
103
103
|
prerelease: false
|
104
|
-
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
|
-
requirements:
|
106
|
+
requirements:
|
107
107
|
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 11
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
- 9
|
113
|
+
- 2
|
114
|
+
- 2
|
109
115
|
version: 0.9.2.2
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: rake_commit
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.13'
|
118
116
|
type: :development
|
117
|
+
version_requirements: *id006
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rake_commit
|
119
120
|
prerelease: false
|
120
|
-
|
121
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
122
|
none: false
|
122
|
-
requirements:
|
123
|
+
requirements:
|
123
124
|
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 17
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
- 13
|
130
|
+
version: "0.13"
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id007
|
126
133
|
description: Backend health tester for HA Services
|
127
|
-
email:
|
134
|
+
email:
|
128
135
|
- code@getbraintree.com
|
129
|
-
executables:
|
136
|
+
executables:
|
130
137
|
- litmus
|
131
138
|
- litmusctl
|
132
139
|
extensions: []
|
140
|
+
|
133
141
|
extra_rdoc_files: []
|
134
|
-
|
142
|
+
|
143
|
+
files:
|
135
144
|
- .gitignore
|
136
145
|
- .rake_commit
|
137
146
|
- .rvmrc
|
@@ -153,6 +162,7 @@ files:
|
|
153
162
|
- lib/litmus_paper/cli/admin/status.rb
|
154
163
|
- lib/litmus_paper/cli/server.rb
|
155
164
|
- lib/litmus_paper/configuration.rb
|
165
|
+
- lib/litmus_paper/configuration_file.rb
|
156
166
|
- lib/litmus_paper/dependency/haproxy_backends.rb
|
157
167
|
- lib/litmus_paper/dependency/http.rb
|
158
168
|
- lib/litmus_paper/dependency/tcp.rb
|
@@ -169,7 +179,7 @@ files:
|
|
169
179
|
- spec/litmus_paper/app_spec.rb
|
170
180
|
- spec/litmus_paper/cli/admin_spec.rb
|
171
181
|
- spec/litmus_paper/cli/server_spec.rb
|
172
|
-
- spec/litmus_paper/
|
182
|
+
- spec/litmus_paper/configuration_file_spec.rb
|
173
183
|
- spec/litmus_paper/dependency/haproxy_backends_spec.rb
|
174
184
|
- spec/litmus_paper/dependency/http_spec.rb
|
175
185
|
- spec/litmus_paper/dependency/tcp_spec.rb
|
@@ -196,35 +206,45 @@ files:
|
|
196
206
|
- spec/support/stub_facter.rb
|
197
207
|
- spec/support/test.config
|
198
208
|
- spec/support/test.d.config
|
209
|
+
has_rdoc: true
|
199
210
|
homepage: https://github.com/braintree/litmus_paper
|
200
211
|
licenses: []
|
212
|
+
|
201
213
|
post_install_message:
|
202
214
|
rdoc_options: []
|
203
|
-
|
215
|
+
|
216
|
+
require_paths:
|
204
217
|
- lib
|
205
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
218
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
206
219
|
none: false
|
207
|
-
requirements:
|
208
|
-
- -
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
|
211
|
-
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
hash: 3
|
224
|
+
segments:
|
225
|
+
- 0
|
226
|
+
version: "0"
|
227
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
228
|
none: false
|
213
|
-
requirements:
|
214
|
-
- -
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
|
229
|
+
requirements:
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
hash: 3
|
233
|
+
segments:
|
234
|
+
- 0
|
235
|
+
version: "0"
|
217
236
|
requirements: []
|
237
|
+
|
218
238
|
rubyforge_project:
|
219
|
-
rubygems_version: 1.
|
239
|
+
rubygems_version: 1.3.7
|
220
240
|
signing_key:
|
221
241
|
specification_version: 3
|
222
242
|
summary: Backend health tester for HA Services, partner project of big_brother
|
223
|
-
test_files:
|
243
|
+
test_files:
|
224
244
|
- spec/litmus_paper/app_spec.rb
|
225
245
|
- spec/litmus_paper/cli/admin_spec.rb
|
226
246
|
- spec/litmus_paper/cli/server_spec.rb
|
227
|
-
- spec/litmus_paper/
|
247
|
+
- spec/litmus_paper/configuration_file_spec.rb
|
228
248
|
- spec/litmus_paper/dependency/haproxy_backends_spec.rb
|
229
249
|
- spec/litmus_paper/dependency/http_spec.rb
|
230
250
|
- spec/litmus_paper/dependency/tcp_spec.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe LitmusPaper::Configuration do
|
4
|
-
describe "evaluate" do
|
5
|
-
it "configures a service" do
|
6
|
-
config = LitmusPaper::Configuration.new(TEST_CONFIG)
|
7
|
-
services = config.evaluate
|
8
|
-
services.has_key?('test').should == true
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "include_files" do
|
13
|
-
it "configures a dir glob of services" do
|
14
|
-
config = LitmusPaper::Configuration.new(TEST_D_CONFIG)
|
15
|
-
services = config.evaluate
|
16
|
-
services.has_key?('test').should == true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|