test_stop_rescue_mode_logs_and_raises_errors breaks when previous_status is DEPLOYED

Bug #1663276 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Blake Rouse

Bug Description

The test does:

  node = factory.make_Node(
      status=NODE_STATUS.RESCUE_MODE,
      previous_status=random.choice([
          NODE_STATUS.READY, NODE_STATUS.BROKEN, NODE_STATUS.DEPLOYED]))

then later on:

  self.patch(node, '_stop').side_effect = exception

before calling stop_rescue_mode.

However, stop_rescue_mode doesn't call _stop all the time:

  if self.previous_status in (NODE_STATUS.READY, NODE_STATUS.BROKEN):
      self._stop(user)
  elif self.previous_status == NODE_STATUS.DEPLOYED:
      self._power_cycle()

The test should patch _power_cycle when the previous_status is DEPLOYED.

This begs another question: what happens when previous_status is not one
of those three statuses? The answer may be "that can't happen", but it
probably will anyway. Perhaps MAAS should power cycle when
previous_status is DEPLOYED and stop in all other situations.

Tags: tests

Related branches

Gavin Panella (allenap)
description: updated
Changed in maas:
importance: High → Critical
Changed in maas:
status: Triaged → In Progress
assignee: nobody → Blake Rouse (blake-rouse)
milestone: none → 2.2.0
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.