alicorn 0.4.1 → 0.4.2.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ - "2.0.0"
6
+ - rbx-19mode
7
+ # uncomment this line if your project needs to run something other than `rake`:
8
+ # script: bundle exec rspec spec
9
+
data/Gemfile CHANGED
@@ -3,10 +3,10 @@ source "http://rubygems.org"
3
3
  gem "raindrops", ">= 0.5.0"
4
4
 
5
5
  group :development do
6
- gem "shoulda", "~> 3.0.1"
7
- gem "rdoc", "~> 3.12"
8
- gem "bundler", "~> 1.3.5"
9
- gem "jeweler", "~> 1.8.3"
10
- gem "mocha", "~> 0.11.4"
11
- gem "simplecov", "~> 0.6.4", :require => false, :platforms => :ruby_19
6
+ gem "shoulda"
7
+ gem "rdoc"
8
+ gem "bundler"
9
+ gem "jeweler"
10
+ gem "mocha"
11
+ gem "simplecov", :require => false
12
12
  end
@@ -9,7 +9,7 @@ GEM
9
9
  rdoc
10
10
  json (1.8.0)
11
11
  metaclass (0.0.1)
12
- mocha (0.11.4)
12
+ mocha (0.14.0)
13
13
  metaclass (~> 0.0.1)
14
14
  multi_json (1.7.6)
15
15
  raindrops (0.11.0)
@@ -21,19 +21,19 @@ GEM
21
21
  shoulda-matchers (~> 1.0.0)
22
22
  shoulda-context (1.0.2)
23
23
  shoulda-matchers (1.0.0)
24
- simplecov (0.6.4)
24
+ simplecov (0.7.1)
25
25
  multi_json (~> 1.0)
26
- simplecov-html (~> 0.5.3)
27
- simplecov-html (0.5.3)
26
+ simplecov-html (~> 0.7.1)
27
+ simplecov-html (0.7.1)
28
28
 
29
29
  PLATFORMS
30
30
  ruby
31
31
 
32
32
  DEPENDENCIES
33
- bundler (~> 1.3.5)
34
- jeweler (~> 1.8.3)
35
- mocha (~> 0.11.4)
33
+ bundler
34
+ jeweler
35
+ mocha
36
36
  raindrops (>= 0.5.0)
37
- rdoc (~> 3.12)
38
- shoulda (~> 3.0.1)
39
- simplecov (~> 0.6.4)
37
+ rdoc
38
+ shoulda
39
+ simplecov
@@ -1,6 +1,7 @@
1
1
  = Alicorn: Auto-scaler for Unicorn webserver
2
2
  {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/bensomers/alicorn]
3
3
  {<img src="https://gemnasium.com/bensomers/alicorn.png" alt="Dependency Status" />}[https://gemnasium.com/bensomers/alicorn]
4
+ {<img src="https://travis-ci.org/bensomers/alicorn.png?branch=master" alt="Build Status" />}[https://travis-ci.org/bensomers/alicorn]
4
5
 
5
6
  An experimental auto-scaler for the {Unicorn}[http://unicorn.bogomips.org]
6
7
  webserver. Designed for Unicorn webservers running with the {Raindrops}[raindrops.bogomips.org]
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "alicorn"
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2.pre"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Somers"]
12
- s.date = "2013-06-12"
12
+ s.date = "2013-06-18"
13
13
  s.description = "Highly configurable dumb auto-scaler for managing unicorn web servers"
14
14
  s.email = "somers.ben@gmail.com"
15
15
  s.executables = ["alicorn", "alicorn-profiler"]
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".document",
22
22
  ".ruby-gemset",
23
+ ".travis.yml",
23
24
  "CHANGELOG.txt",
24
25
  "Gemfile",
25
26
  "Gemfile.lock",
@@ -54,29 +55,29 @@ Gem::Specification.new do |s|
54
55
 
55
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
57
  s.add_runtime_dependency(%q<raindrops>, [">= 0.5.0"])
57
- s.add_development_dependency(%q<shoulda>, ["~> 3.0.1"])
58
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
- s.add_development_dependency(%q<bundler>, ["~> 1.3.5"])
60
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
61
- s.add_development_dependency(%q<mocha>, ["~> 0.11.4"])
62
- s.add_development_dependency(%q<simplecov>, ["~> 0.6.4"])
58
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
60
+ s.add_development_dependency(%q<bundler>, [">= 0"])
61
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
62
+ s.add_development_dependency(%q<mocha>, [">= 0"])
63
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
63
64
  else
64
65
  s.add_dependency(%q<raindrops>, [">= 0.5.0"])
65
- s.add_dependency(%q<shoulda>, ["~> 3.0.1"])
66
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
- s.add_dependency(%q<bundler>, ["~> 1.3.5"])
68
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
69
- s.add_dependency(%q<mocha>, ["~> 0.11.4"])
70
- s.add_dependency(%q<simplecov>, ["~> 0.6.4"])
66
+ s.add_dependency(%q<shoulda>, [">= 0"])
67
+ s.add_dependency(%q<rdoc>, [">= 0"])
68
+ s.add_dependency(%q<bundler>, [">= 0"])
69
+ s.add_dependency(%q<jeweler>, [">= 0"])
70
+ s.add_dependency(%q<mocha>, [">= 0"])
71
+ s.add_dependency(%q<simplecov>, [">= 0"])
71
72
  end
72
73
  else
73
74
  s.add_dependency(%q<raindrops>, [">= 0.5.0"])
74
- s.add_dependency(%q<shoulda>, ["~> 3.0.1"])
75
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
76
- s.add_dependency(%q<bundler>, ["~> 1.3.5"])
77
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
78
- s.add_dependency(%q<mocha>, ["~> 0.11.4"])
79
- s.add_dependency(%q<simplecov>, ["~> 0.6.4"])
75
+ s.add_dependency(%q<shoulda>, [">= 0"])
76
+ s.add_dependency(%q<rdoc>, [">= 0"])
77
+ s.add_dependency(%q<bundler>, [">= 0"])
78
+ s.add_dependency(%q<jeweler>, [">= 0"])
79
+ s.add_dependency(%q<mocha>, [">= 0"])
80
+ s.add_dependency(%q<simplecov>, [">= 0"])
80
81
  end
81
82
  end
82
83
 
@@ -83,10 +83,10 @@ module Alicorn
83
83
  protected
84
84
 
85
85
  def collect_data
86
- logger.debug "Sampling #{sample_count} times at #{delay} second intervals"
86
+ logger.debug "Sampling #{listener_type} listener at #{listener_address} #{sample_count} times at #{delay} second intervals"
87
87
  active, queued = DataSet.new, DataSet.new
88
88
  sample_count.times do
89
- stats = Raindrops::Linux.send(:"#{listener_type}_listener_stats", listener_address)[listener_address]
89
+ stats = Raindrops::Linux.send(:"#{listener_type}_listener_stats")[listener_address]
90
90
  active << stats.active
91
91
  queued << stats.queued
92
92
  sleep(delay)
@@ -1,3 +1,3 @@
1
1
  module Alicorn
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2.pre"
3
3
  end
@@ -14,7 +14,7 @@ rescue Bundler::BundlerError => e
14
14
  end
15
15
  require 'test/unit'
16
16
  require 'shoulda'
17
- require 'mocha'
17
+ require 'mocha/setup'
18
18
 
19
19
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
20
20
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -7,7 +7,7 @@ class TestScaler < Test::Unit::TestCase
7
7
 
8
8
  # stub out stats gathering
9
9
  mock_struct = stub_everything(:active => 4, :queued => 0)
10
- Raindrops::Linux.stubs(:tcp_listener_stats).returns({"0.0.0.0:80" => mock_struct})
10
+ Raindrops::Linux.stubs(:tcp_listener_stats).with().returns({"0.0.0.0:80" => mock_struct})
11
11
 
12
12
  # enable us to test private methods, for the complicated ones
13
13
  class << @scaler
@@ -192,11 +192,29 @@ class TestScaler < Test::Unit::TestCase
192
192
  end
193
193
 
194
194
  context "#collect_data" do
195
- should "return the correct data" do
196
- data = @scaler.send(:collect_data)
197
- expected_data = { :active => [4]*30,
198
- :queued => [0]*30 }
199
- assert_equal expected_data, data
195
+ context "when using a tcp listener" do
196
+ should "return the correct data" do
197
+ data = @scaler.send(:collect_data)
198
+ expected_data = { :active => [4]*30,
199
+ :queued => [0]*30 }
200
+ assert_equal expected_data, data
201
+ end
202
+ end
203
+
204
+
205
+ context "when using a unix listener" do
206
+
207
+ should "sample unix stats as well as tcp" do
208
+ @scaler.listener_type = :unix
209
+ @scaler.listener_address = "/tmp/app.socket"
210
+ mock_struct = stub_everything(:active => 6, :queued => 0)
211
+ Raindrops::Linux.expects(:unix_listener_stats).times(30).with().returns({"/tmp/app.socket" => mock_struct})
212
+
213
+ data = @scaler.send(:collect_data)
214
+ expected_data = { :active => [6]*30,
215
+ :queued => [0]*30 }
216
+ assert_equal expected_data, data
217
+ end
200
218
  end
201
219
  end
202
220
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alicorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.4.2.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Somers
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-12 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: raindrops
@@ -32,97 +32,97 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 3.0.1
37
+ version: '0'
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 3.0.1
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rdoc
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ~>
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '3.12'
53
+ version: '0'
54
54
  type: :development
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: '3.12'
61
+ version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bundler
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ~>
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 1.3.5
69
+ version: '0'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ~>
75
+ - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 1.3.5
77
+ version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: jeweler
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ~>
83
+ - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: 1.8.3
85
+ version: '0'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ~>
91
+ - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: 1.8.3
93
+ version: '0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: mocha
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ~>
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: 0.11.4
101
+ version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ~>
107
+ - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.11.4
109
+ version: '0'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: simplecov
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - ~>
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.6.4
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - ~>
123
+ - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
- version: 0.6.4
125
+ version: '0'
126
126
  description: Highly configurable dumb auto-scaler for managing unicorn web servers
127
127
  email: somers.ben@gmail.com
128
128
  executables:
@@ -135,6 +135,7 @@ extra_rdoc_files:
135
135
  files:
136
136
  - .document
137
137
  - .ruby-gemset
138
+ - .travis.yml
138
139
  - CHANGELOG.txt
139
140
  - Gemfile
140
141
  - Gemfile.lock
@@ -172,13 +173,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  segments:
174
175
  - 0
175
- hash: -1826442975081019144
176
+ hash: 770616866604528155
176
177
  required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  none: false
178
179
  requirements:
179
- - - ! '>='
180
+ - - ! '>'
180
181
  - !ruby/object:Gem::Version
181
- version: '0'
182
+ version: 1.3.1
182
183
  requirements: []
183
184
  rubyforge_project:
184
185
  rubygems_version: 1.8.25