heroku-scalr 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/heroku-scalr.gemspec +1 -1
- data/lib/heroku/scalr/app.rb +1 -1
- data/spec/heroku/scalr/app_spec.rb +5 -5
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/heroku-scalr.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.name = File.basename(__FILE__, '.gemspec')
|
8
8
|
s.summary = "Watch and scale your dynos!"
|
9
9
|
s.description = "Issues recurring 'pings' to your Heroku apps and scales dynos up or down depending on pre-defined rules"
|
10
|
-
s.version = "0.2.
|
10
|
+
s.version = "0.2.2"
|
11
11
|
|
12
12
|
s.authors = ["Black Square Media"]
|
13
13
|
s.email = "info@blacksquaremedia.com"
|
data/lib/heroku/scalr/app.rb
CHANGED
@@ -106,7 +106,7 @@ class Heroku::Scalr::App
|
|
106
106
|
end
|
107
107
|
|
108
108
|
log :info, "scaling to #{target} dynos"
|
109
|
-
result = api.
|
109
|
+
result = api.post_ps_scale(name, "web", target)
|
110
110
|
unless result.status == 200
|
111
111
|
log :warn, "error scaling app, responded with #{result.status}"
|
112
112
|
return
|
@@ -44,7 +44,7 @@ describe Heroku::Scalr::App do
|
|
44
44
|
|
45
45
|
describe "scaling" do
|
46
46
|
before do
|
47
|
-
subject.api.stub get_app: mock_response(200, { "dynos" => 2 }),
|
47
|
+
subject.api.stub get_app: mock_response(200, { "dynos" => 2 }), post_ps_scale: mock_response(200, "")
|
48
48
|
subject.metric.stub by: -1
|
49
49
|
end
|
50
50
|
|
@@ -77,13 +77,13 @@ describe Heroku::Scalr::App do
|
|
77
77
|
context "down" do
|
78
78
|
|
79
79
|
it "should return the new number of dynos" do
|
80
|
-
subject.api.should_receive(:
|
80
|
+
subject.api.should_receive(:post_ps_scale).with("name", "web", 1).and_return mock_response(200, "")
|
81
81
|
subject.scale!.should == 1
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should skip if min number of dynos reached" do
|
85
85
|
subject.api.should_receive(:get_app).with("name").and_return mock_response(200, { "dynos" => 1 })
|
86
|
-
subject.api.should_not_receive(:
|
86
|
+
subject.api.should_not_receive(:post_ps_scale)
|
87
87
|
subject.scale!.should be_nil
|
88
88
|
end
|
89
89
|
|
@@ -94,13 +94,13 @@ describe Heroku::Scalr::App do
|
|
94
94
|
before { subject.metric.stub by: 1 }
|
95
95
|
|
96
96
|
it "should return the new number of dynos" do
|
97
|
-
subject.api.should_receive(:
|
97
|
+
subject.api.should_receive(:post_ps_scale).with("name", "web", 3).and_return mock_response(200, "")
|
98
98
|
subject.scale!.should == 3
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should skip if max number of dynos reached" do
|
102
102
|
subject.api.should_receive(:get_app).with("name").and_return mock_response(200, { "dynos" => 3 })
|
103
|
-
subject.api.should_not_receive(:
|
103
|
+
subject.api.should_not_receive(:post_ps_scale)
|
104
104
|
subject.scale!.should be_nil
|
105
105
|
end
|
106
106
|
|