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

Commit

Permalink
Bug 1160934 - "oo-admin-ctl-gears stopgear" failed to stop idled gear
Browse files Browse the repository at this point in the history
During the 'idlegear' operation, the gear in fact is stopped but the
state value is changed to 'idle'. Then, subsequently, when 'stopgear'
operation is excuted, the cartridge doesn't perform any extra works
as the gear is already stopped. However, the state is not modified
to 'stopped' due to lacking of explicit state change in application
container itself.

This commit will add explicit state change to application container
to ensuring the state is changed accordingly.

Bug 1160934
Link <https://bugzilla.redhat.com/show_bug.cgi?id=1160934>

Signed-off-by: Vu Dinh <vdinh@redhat.com>
  • Loading branch information
dinhxuanvu committed Dec 8, 2015
1 parent bfd9d70 commit f557bd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -504,6 +504,7 @@ def stop_gear(options={})

begin
buffer << @cartridge_model.stop_gear(options)
state.value = State::STOPPED
rescue ::OpenShift::Runtime::Utils::ShellExecutionException => e
raise e if options[:user_initiated] == true || options[:force] == false

Expand Down
5 changes: 5 additions & 0 deletions node/test/unit/application_container_test.rb
Expand Up @@ -1245,6 +1245,7 @@ def test_stop_gear_no_proxy
options = {}
@container.cartridge_model.expects(:web_proxy).returns(nil)
@container.cartridge_model.expects(:stop_gear).with(options).returns('stop')
@container.state.expects(:value=).with(OpenShift::Runtime::State::STOPPED)
@container.expects(:stopped_status_attr).returns('attr')
@container.stop_gear(options)
end
Expand All @@ -1262,6 +1263,7 @@ def test_stop_gear_no_hot_deploy_no_init
persist: false)
.returns(proxy_result)
@container.cartridge_model.expects(:stop_gear).with(options).returns('stop')
@container.state.expects(:value=).with(OpenShift::Runtime::State::STOPPED)
@container.expects(:stopped_status_attr).returns('attr')
@container.stop_gear(options)
end
Expand All @@ -1272,6 +1274,7 @@ def test_stop_gear_hot_deploy
@container.cartridge_model.expects(:web_proxy).returns(proxy_cart)
@container.expects(:update_proxy_status).never
@container.cartridge_model.expects(:stop_gear).with(options).returns('stop')
@container.state.expects(:value=).with(OpenShift::Runtime::State::STOPPED)
@container.expects(:stopped_status_attr).returns('attr')
@container.stop_gear(options)
end
Expand All @@ -1282,6 +1285,7 @@ def test_stop_gear_init
@container.cartridge_model.expects(:web_proxy).returns(proxy_cart)
@container.expects(:update_proxy_status).never
@container.cartridge_model.expects(:stop_gear).with(options).returns('stop')
@container.state.expects(:value=).with(OpenShift::Runtime::State::STOPPED)
@container.expects(:stopped_status_attr).returns('attr')
@container.stop_gear(options)
end
Expand All @@ -1299,6 +1303,7 @@ def test_stop_gear_exception
def test_stop_gear_no_exception
options = {user_initiated: false, force: true}
@container.cartridge_model.expects(:stop_gear).with(options).returns('stop')
@container.state.expects(:value=).with(OpenShift::Runtime::State::STOPPED)

assert_nothing_raised do
@container.stop_gear(options)
Expand Down

0 comments on commit f557bd3

Please sign in to comment.