-
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.
Merge pull request #74 from splaplapla/support-upgrade-in-pbm-cloud
pbm-cloudからupgradeができるようにする
- Loading branch information
Showing
9 changed files
with
54 additions
and
4 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
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
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
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
10 changes: 10 additions & 0 deletions
10
lib/procon_bypass_man/background/jobs/report_completed_upgrade_pbm_job.rb
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,10 @@ | ||
class ProconBypassMan::ReportCompletedUpgradePbmJob < ProconBypassMan::ReportEventBaseJob | ||
extend ProconBypassMan::HasExternalApiSetting | ||
|
||
def self.perform | ||
ProconBypassMan::ReportHttpClient.new( | ||
path: path, | ||
server_pool: server_pool, | ||
).post(body: nil, event_type: :completed_upgrade_pbm) | ||
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
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
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
33 changes: 33 additions & 0 deletions
33
spec/lib/procon_bypass_man/background/jobs/report_completed_upgrade_pbm_job_spec.rb
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,33 @@ | ||
require "spec_helper" | ||
|
||
describe ProconBypassMan::ReportCompletedUpgradePbmJob do | ||
describe '.perform' do | ||
context 'ProconBypassMan.api_serverが設定されていない時' do | ||
before do | ||
ProconBypassMan.configure do |config| | ||
config.api_servers = nil | ||
end | ||
end | ||
|
||
it do | ||
expect(ProconBypassMan.config.api_servers).to eq([]) | ||
expect { described_class.perform() }.not_to raise_error | ||
end | ||
end | ||
|
||
context 'ProconBypassMan.api_serversが設定しているとき' do | ||
before do | ||
ProconBypassMan.configure do |config| | ||
config.api_servers = "http://localhost:3000" | ||
end | ||
end | ||
|
||
it do | ||
http_response = double(:http_response).as_null_object | ||
expect(http_response).to receive(:code) { "200" } | ||
expect_any_instance_of(Net::HTTP).to receive(:post) { http_response } | ||
expect { described_class.perform }.not_to raise_error | ||
end | ||
end | ||
end | ||
end |