Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Inform user of the need to scale up when enabling HA on a scaled appl…
Browse files Browse the repository at this point in the history
…ication

Bug 1256952
https://bugzilla.redhat.com/show_bug.cgi?id=1256952

When an application with more than one gear ha HA enabled, a short message will now be given stating the possible need to scale the application up to actually receive the second haproxy instance.

In addition to a adding a new test, the `app_spec.rb` now requires 'net/ssh/multi' to allow the spec to be run on its own outside of the RHC spec test suite. This has been resolved.
  • Loading branch information
tiwillia committed Oct 30, 2015
1 parent 5eb2f92 commit 82fca17
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/rhc/commands/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,16 @@ def tidy(app)
syntax "<app> [--namespace NAME]"
takes_application :argument => true
def enable_ha(app)
app_action :enable_ha
rest_app = find_app
result = rest_app.send :enable_ha

results { say "#{app} is now highly available" }
results do
say "#{app} is now highly available"
# If the application was already scaled, a scale up may be required.
if rest_app.attributes["gear_count"] > 1
say "You may need to scale up the application to create an additional haproxy instance."
end
end
0
end

Expand Down
17 changes: 17 additions & 0 deletions spec/rhc/commands/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'rhc/config'
require 'rhc/servers'
require 'resolv'
require 'net/ssh/multi'

describe RHC::Commands::App do
let!(:rest_client){ MockRestClient.new }
Expand Down Expand Up @@ -933,6 +934,22 @@
end
end

describe 'app enable-ha on scaled application' do
before do
@domain = rest_client.add_domain("mockdomain")
@app = @domain.add_application("app1", "mock_type", true)
@app.add_cartridge('mock_cart-1')
@app.scale_up
end

let(:arguments) { ['app', 'enable-ha', 'app1'] }

it "should suggest scaling up to receive additional haproxy instances" do
run_output.should match(/You may need to scale up/)
expect{ run }.to exit_with_code(0)
end
end

describe "#create_app" do
it("should list cartridges when a server error happens") do
subject.should_receive(:list_cartridges)
Expand Down

0 comments on commit 82fca17

Please sign in to comment.