wrong argument value for work_on_disk() in unit test

Bug #1417837 reported by wei du
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Low
wei du

Bug Description

Observed Version: master

The problem:

The work_on_disk() function is defined with 7 normal arguments and 2 optional arguments in [1]. The 'node_uuid' should be a string containing uuid for the node, mainly for logging purposes.

However, there are several places in the unit test where the 7th argument to work_in_disk() is False. For example, WorkOnDiskTestCase.test_no_parent_device() has:

        self.assertRaises(exception.InstanceDeployFailure,
                          utils.work_on_disk, self.dev, self.root_mb,
                          self.swap_mb, self.ephemeral_mb,
                          self.ephemeral_format, self.image_path, False)

The 'False' should be for 'preserve_ephemeral' parameter; instead, it is being used as the value for node_uuid.

Functions test_no_root_partition(), test_no_swap_partition() and test_no_ephemeral_partition() have the similar problem.

The proposed fix:
     - to provide a fake string as the node_uuid for work_in_disk() function. For example,

        self.assertRaises(exception.InstanceDeployFailure,
                          utils.work_on_disk, self.dev, self.root_mb,
                          self.swap_mb, self.ephemeral_mb,
                          self.ephemeral_format, self.image_path,
                          "fake-uuid")

[1] https://github.com/openstack/ironic/blob/53a93ad49d5ffcd1ae76747ca826676e4c4ef5cb/ironic/drivers/modules/deploy_utils.py#L419

wei du (weidu)
Changed in ironic:
assignee: nobody → wei du (weidu)
Revision history for this message
wei du (weidu) wrote :
Revision history for this message
wei du (weidu) wrote :
Ruby Loo (rloo)
Changed in ironic:
status: New → Triaged
importance: Undecided → Low
wei du (weidu)
description: updated
Changed in ironic:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

Fix proposed to branch: master
Review: https://review.openstack.org/153072

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/153072
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=f004f41614d900f71854c4dc732ba667d44aa4b5
Submitter: Jenkins
Branch: master

commit f004f41614d900f71854c4dc732ba667d44aa4b5
Author: Wei Du <email address hidden>
Date: Wed Feb 4 22:24:11 2015 +0000

    Fix argument value for work_on_disk() in unit test

    The work_on_disk() function is defined with 7 normal arguments
    and 2 optional arguments. The 'node_uuid' should be a string
    containing uuid for the node, mainly for logging purposes.

    However, there are several places in the unit test where the 7th
    argument to work_in_disk() is False. This commit will provide a
    fake string as the node_uuid for the function.

    Change-Id: I03563ce0bda96069173060b412293a0a83101e2e
    Closes-bug: #1417837

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: kilo-3 → 2015.1.0
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.