[PATCH aeolus-conductor 1/2] RM #3448 - Fixes instance.feature:66 test
Richard Su
rwsu at redhat.com
Fri Jul 6 00:20:19 UTC 2012
On 07/05/2012 01:45 PM, Matt Wagner wrote:
> This cleans up task.rb to fix a strange failure that was being
> encountered when using newer versions of Rails (via Bundler).
>
> Resolves https://www.aeolusproject.org/redmine/issues/3448
> ---
> src/app/models/task.rb | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/app/models/task.rb b/src/app/models/task.rb
> index 86d966c..6d65fcc 100644
> --- a/src/app/models/task.rb
> +++ b/src/app/models/task.rb
> @@ -76,6 +76,8 @@ class Task < ActiveRecord::Base
> validates_inclusion_of :state,
> :in => COMPLETED_STATES + WORKING_STATES
>
> + after_initialize :initialize_state
> +
> # FIXME validate action depending on type / subclass
> # validate task_target_id, task_type_id, arg, message
> # depending on subclass, action, state
> @@ -89,11 +91,6 @@ class Task < ActiveRecord::Base
> ["Canceled", Task::STATE_CANCELED, "break"],
> ["All States", ""]]
>
> - def initialize(params)
> - super
> - self.state = STATE_QUEUED unless self.state
> - end
> -
> def cancel
> self[:state] = STATE_CANCELED
> save!
> @@ -143,4 +140,8 @@ class Task < ActiveRecord::Base
> errors.add("time_ended", "Tasks ends before it's started") unless time_ended.nil? or time_started.nil? or time_ended >= time_started
> errors.add("time_started", "Tasks starts before it's created") unless time_started.nil? or created_at.nil? or time_started >= created_at
> end
> +
> + def initialize_state
> + self.state = STATE_QUEUED unless self.state
> + end
> end
I wasn't able to reproduce the error you were seeing. With and without
bundler I see these three errors in instance.feature with all services
turned off.
Scenario: Stop instance #
features/instance.feature:66
Given there is a "mock1" running instance #
features/step_definitions/instance_steps.rb:85
And I am on the instances page #
features/step_definitions/web_steps.rb:59
When I check "mock1" instance #
features/step_definitions/instance_steps.rb:106
And I press "stop_selected_instances" #
features/step_definitions/web_steps.rb:68
Then I should be on the instances page #
features/step_definitions/web_steps.rb:203
And I should see "mock1: stop action was successfully queued" #
features/step_definitions/web_steps.rb:121
expected there to be content "mock1: stop action was successfully
queued" in "\nAeolus Conductor\n\n\n\n //<![CDATA[\n window.Conductor
= {}\n window.Conductor.PATH_PREFIX = \"/\"\n // This hack prevents
Backbone from switching to the #/pools/1 type URLs\n // when the
browser doesn't support the HTML5 History API.\n window.history ||
(window.history = {});\n window.history.pushState ||
(window.history.pushState = function(){});\n window.history.replaceState
|| (window.history.replaceState = function(){});\n
//]]>\n\n\n\n\n\n\nMonitorAdminister\nJohn Smith\nMy Account\nLog
out\n\n\n\n\nTerminate Instances\n\n\nProvider is not accessible, status
of following instances will be changed to 'stopped' but their actual
state is unknown.\n\n\nmock1\nCancel\n\n\n\nCopyright © 2009-2012 Red
Hat, Inc.\n\n" (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:123:in `/^(?:|I )should
see "([^"]*)"$/'
features/instance.feature:72:in `And I should see "mock1: stop
action was successfully queued"'
Scenario: Stop multiple instances #
features/instance.feature:85
Given there is a "mock1" running instance #
features/step_definitions/instance_steps.rb:85
And there is a "mock2" running instance #
features/step_definitions/instance_steps.rb:85
And there is a "mock3" stopped instance #
features/step_definitions/instance_steps.rb:89
And I am on the instances page #
features/step_definitions/web_steps.rb:59
When I check "mock1" instance #
features/step_definitions/instance_steps.rb:106
And I check "mock2" instance #
features/step_definitions/instance_steps.rb:106
And I check "mock3" instance #
features/step_definitions/instance_steps.rb:106
And I press "stop_selected_instances" #
features/step_definitions/web_steps.rb:68
Then I should be on the instances page #
features/step_definitions/web_steps.rb:203
And I should see "mock1: stop action was successfully queued" #
features/step_definitions/web_steps.rb:121
expected there to be content "mock1: stop action was successfully
queued" in "\nAeolus Conductor\n\n\n\n //<![CDATA[\n window.Conductor
= {}\n window.Conductor.PATH_PREFIX = \"/\"\n // This hack prevents
Backbone from switching to the #/pools/1 type URLs\n // when the
browser doesn't support the HTML5 History API.\n window.history ||
(window.history = {});\n window.history.pushState ||
(window.history.pushState = function(){});\n window.history.replaceState
|| (window.history.replaceState = function(){});\n
//]]>\n\n\n\n\n\n\nMonitorAdminister\nJohn Smith\nMy Account\nLog
out\n\n\n\n\nTerminate Instances\n\n\nProvider is not accessible, status
of following instances will be changed to 'stopped' but their actual
state is unknown.\n\n\nmock1\nmock2\nCancel\n\n\n\nCopyright © 2009-2012
Red Hat, Inc.\n\n" (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:123:in `/^(?:|I )should
see "([^"]*)"$/'
features/instance.feature:95:in `And I should see "mock1: stop
action was successfully queued"'
And I should see "mock2: stop action was successfully queued" #
features/step_definitions/web_steps.rb:121
And I should see "mock3: stop is an invalid action" #
features/step_definitions/web_steps.rb:121
#Scenario: Create an instance over XHR
# Given I request XHR
# When I create mock instance
# Then I should get back a partial
Scenario: Stop an instance #
features/instance.feature:202
Given there is a "mock1" running instance #
features/step_definitions/instance_steps.rb:85
And I accept JSON #
features/step_definitions/instance_steps.rb:139
When I stop "mock1" instance #
features/step_definitions/instance_steps.rb:168
Then I should get back JSON object with success and errors #
features/step_definitions/instance_steps.rb:173
expected: not nil
got: nil (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/instance_steps.rb:175:in `/^I should
get back JSON object with success and errors$/'
features/instance.feature:206:in `Then I should get back JSON
object with success and errors'
More information about the aeolus-devel
mailing list