← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1426265] [NEW] dhcp _test_sync_state_helper does not assert calls properly

 

Public bug reported:

There are a few problems with _test_sync_state_helper

1. calling assert_has_called() on a mock object does nothing - should be assert_has_calls()
2. sync_state() no longer calls refresh_dhcp_helper()
3. safe_configure_dhcp_for_network() is not mocked out
4. it does a set diff between sets of different types


export NOSE_NOLOGCAPTURE=1
export OS_DEBUG=1
$ nosetests -v neutron.tests.unit.test_dhcp_agent:TestDhcpAgent.test_sync_state_disabled_net
...
2015-02-27 08:35:49,105     INFO [neutron.agent.dhcp.agent] Synchronizing state
2015-02-27 08:35:49,106    ERROR [neutron.agent.dhcp.agent] Unable to sync network state.
Traceback (most recent call last):
  File "/opt/stack/neutron/neutron/agent/dhcp/agent.py", line 150, in sync_state
    active_network_ids = set(network.id for network in active_networks)
  File "/opt/stack/neutron/neutron/agent/dhcp/agent.py", line 150, in <genexpr>
    active_network_ids = set(network.id for network in active_networks)
AttributeError: 'str' object has no attribute 'id'
2015-02-27 08:35:49,107    DEBUG [oslo_concurrency.lockutils] Lock "dhcp-agent" released by "sync_state" :: held 0.002s
passed

** Affects: neutron
     Importance: Undecided
     Assignee: Darragh O'Reilly (darragh-oreilly)
         Status: In Progress


** Tags: unittest

** Changed in: neutron
     Assignee: (unassigned) => Darragh O'Reilly (darragh-oreilly)

** Changed in: neutron
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1426265

Title:
  dhcp _test_sync_state_helper does not assert calls properly

Status in OpenStack Neutron (virtual network service):
  In Progress

Bug description:
  There are a few problems with _test_sync_state_helper

  1. calling assert_has_called() on a mock object does nothing - should be assert_has_calls()
  2. sync_state() no longer calls refresh_dhcp_helper()
  3. safe_configure_dhcp_for_network() is not mocked out
  4. it does a set diff between sets of different types

  
  export NOSE_NOLOGCAPTURE=1
  export OS_DEBUG=1
  $ nosetests -v neutron.tests.unit.test_dhcp_agent:TestDhcpAgent.test_sync_state_disabled_net
  ...
  2015-02-27 08:35:49,105     INFO [neutron.agent.dhcp.agent] Synchronizing state
  2015-02-27 08:35:49,106    ERROR [neutron.agent.dhcp.agent] Unable to sync network state.
  Traceback (most recent call last):
    File "/opt/stack/neutron/neutron/agent/dhcp/agent.py", line 150, in sync_state
      active_network_ids = set(network.id for network in active_networks)
    File "/opt/stack/neutron/neutron/agent/dhcp/agent.py", line 150, in <genexpr>
      active_network_ids = set(network.id for network in active_networks)
  AttributeError: 'str' object has no attribute 'id'
  2015-02-27 08:35:49,107    DEBUG [oslo_concurrency.lockutils] Lock "dhcp-agent" released by "sync_state" :: held 0.002s
  passed

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1426265/+subscriptions


Follow ups

References