-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Dummy Sensor and Actuator integration test' do | ||
before(:context) do | ||
@logger = Logger.new(STDOUT) | ||
end | ||
|
||
it 'should initialize correctly' do | ||
sensor = SidekiqAutoscaler::Sensor::DummySensor.new | ||
actuator = SidekiqAutoscaler::Actuator::DummyActuator.new | ||
as = SidekiqAutoscaler::Autoscaler.new(sensor, actuator) | ||
as.logger = @logger | ||
|
||
as.start!(0) | ||
sleep 5 | ||
as.stop! | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'spec_helper' | ||
require 'sidekiq_autoscaler/actuator/heroku_worker_actuator' | ||
|
||
describe 'HerokuWorkerActuator' do | ||
before(:context) do | ||
end | ||
|
||
|
||
it 'should initialize with params' do | ||
SidekiqAutoscaler::Actuator::HerokuWorkerActuator.new({ | ||
'SIDEKIQ_AUTOSCALER_APP_NAME' => 'not_empty', | ||
'SIDEKIQ_AUTOSCALER_HEROKU_API_KEY' => 'not_empty' | ||
}) | ||
end | ||
end | ||
|
||
describe 'HerokuWorkerActuator Exceptions' do | ||
before(:context) do | ||
end | ||
|
||
it 'should fail on initialize without app_name' do | ||
expect { | ||
SidekiqAutoscaler::Actuator::HerokuWorkerActuator.new({ | ||
'SIDEKIQ_AUTOSCALER_HEROKU_API_KEY' => 'not_empty' | ||
}) | ||
}.to raise_error(StandardError) | ||
end | ||
|
||
it 'should fail on initialize without heroku_api_key' do | ||
expect { | ||
SidekiqAutoscaler::Actuator::HerokuWorkerActuator.new({ | ||
'SIDEKIQ_AUTOSCALER_APP_NAME' => 'not_empty' | ||
}) | ||
}.to raise_error(StandardError) | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
require 'sidekiq_autoscaler/sensor/sidekiq_sensor' | ||
|
||
describe 'SidekiqSensor' do | ||
before(:context) do | ||
end | ||
|
||
|
||
it 'should initialize with params' do | ||
SidekiqAutoscaler::Sensor::SidekiqSensor.new({ | ||
'SIDEKIQ_AUTOSCALER_APP_NAME' => 'not_empty', | ||
'SIDEKIQ_AUTOSCALER_HEROKU_API_KEY' => 'not_empty' | ||
}) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ref http://stackoverflow.com/questions/4398262/setup-rspec-to-test-a-gem-not-rails | ||
require 'bundler/setup' | ||
Bundler.setup | ||
|
||
require 'sidekiq_autoscaler' | ||
|
||
require 'logger' | ||
|
||
require 'rspec' | ||
require 'rspec/collection_matchers' | ||
|
||
RSpec.configure do |config| | ||
# config.color_enabled = true | ||
config.formatter = 'documentation' | ||
#RAILS 5:config.file_fixture_path = "spec/example" | ||
end |