makedirs should be stubbed out

Bug #1211952 reported by Armando Migliaccio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Armando Migliaccio

Bug Description

When I run the dhcp_agent test on my box I got this error once:

======================================================================
ERROR: neutron.tests.unit.test_dhcp_agent.TestDhcpAgent.test_call_driver_failure (subunit.RemotedTestCase)
neutron.tests.unit.test_dhcp_agent.TestDhcpAgent.test_call_driver_failure
----------------------------------------------------------------------
_StringException: Empty attachments:
  pythonlogging:''
  stderr
  stdout

Traceback (most recent call last):
  File "/home/armax/workspace/openstack/neutron/neutron/tests/unit/test_dhcp_agent.py", line 215, in test_call_driver_failure
    dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
  File "/home/armax/workspace/openstack/neutron/neutron/agent/dhcp_agent.py", line 78, in __init__
    os.makedirs(dhcp_dir, 0o755)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '//home/guest/workspace/openstack/neutron/dhcp'

Ideally the directory creation should be stubbed out in the tests.

Tags: l3-ipam-dhcp
Changed in neutron:
assignee: nobody → Armando Migliaccio (armando-migliaccio)
Changed in neutron:
status: New → Triaged
importance: Undecided → High
milestone: none → havana-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/42001
Committed: http://github.com/openstack/neutron/commit/2786a6cafa6edaf5438a3dacf54b160d8a733e7b
Submitter: Jenkins
Branch: master

commit 2786a6cafa6edaf5438a3dacf54b160d8a733e7b
Author: armando-migliaccio <email address hidden>
Date: Wed Aug 14 12:05:43 2013 -0700

    Mock os.makdirs to avoid directory creation in unit tests

    The directory 'dhcp' under neutron state path should not be
    created during unit tests. This patch mocks up calls to
    os.makedirs and ensures that methods that rely on it, like
    _populate_network_cache, are mocked as well.

    Fixes bug #1211952

    Change-Id: I83998d4e631b1ebeab90b4c3c0276aa2ffe22c50

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-3 → 2013.2
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.