Wrong unit test logic when we check the scheduler Diskfilter

Bug #1070264 reported by Andrea Rosa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Andrea Rosa

Bug Description

The unit test "test_disk_filter_fails" for testing the scheuler disk filter has a wrong logic.
I think it's supposed to test a failure in the host_passes check but as is it is not working.
We need to create and 'insance_type' which requires a disk that exceeds the disk availability in the host:

@@ -556,14 +556,14 @@ class HostFiltersTestCase(test.TestCase):
         self._stub_service_is_up(True)
         filt_cls = self.class_map['DiskFilter']()
         self.flags(disk_allocation_ratio=1.0)
- filter_properties = {'instance_type': {'root_gb': 2,
+ filter_properties = {'instance_type': {'root_gb': 11,
                                                'ephemeral_gb': 1}}
         capabilities = {'enabled': True}
         service = {'disabled': False}
         host = fakes.FakeHostState('host1', 'compute',
                 {'free_disk_mb': 11 * 1024, 'total_usable_disk_gb': 13,
                  'capabilities': capabilities, 'service': service})
- self.assertTrue(filt_cls.host_passes(host, filter_properties))
+ self.assertFalse(filt_cls.host_passes(host, filter_properties))

Revision history for this message
Andrea Rosa (andrea-rosa-m) wrote :

As reported in the comment I have the code change ready for that

Changed in nova:
assignee: nobody → Andrea Rosa (andrea-rosa-m)
status: New → Opinion
Changed in nova:
status: Opinion → In Progress
tags: added: low-hanging-fruit
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/14669
Committed: http://github.com/openstack/nova/commit/9ec1f131822a8ba1b849732bcde001d228c7e98e
Submitter: Jenkins
Branch: master

commit 9ec1f131822a8ba1b849732bcde001d228c7e98e
Author: Andrea Rosa <email address hidden>
Date: Tue Oct 23 11:58:16 2012 +0100

    Fix bug in a test for the scheduler DiskFilter.

    There is an error in the logic for a unit test in the Scheduler DiskFilter.
    We need to test the failure of the host_passes check with the
    "test_disk_filter_fails" test.

    Fixes bug 1070264.

    Change-Id: Ib07f47b74a6634c573dca8fb4efa2d95b2e1ed87

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-1 → 2013.1
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.