Inconsistent keyword for automatic deletion of resources during unit tests

Bug #1336196 reported by Assaf Muller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Assaf Muller

Bug Description

Ports, networks and subnets have a do_delete=True parameter. By default, these resources are deleted at the end of the context manager scope. All other resources use a different semantic: no_delete=False.

This causes confusing situations such as:
with self.subnet(network, do_delete=False) as subnet:
    with self.security_group(no_delete=True) as sg:
        pass

I personally fell to the pitfall of using do_delete for the security group and was surprised when it wasn't deleted at the end of the scope.

Finally, the double negative of no_delete=False is confusing and should be avoided.

Tags: unittest
Assaf Muller (amuller)
Changed in neutron:
assignee: nobody → Assaf Muller (amuller)
description: updated
Changed in neutron:
status: New → In Progress
Edgar Magana (emagana)
Changed in neutron:
importance: Undecided → Medium
Kyle Mestery (mestery)
Changed in neutron:
milestone: none → juno-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/92013
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=69dfbd9468282f9ce16cc5b0cb1bcb121632a0d8
Submitter: Jenkins
Branch: master

commit 69dfbd9468282f9ce16cc5b0cb1bcb121632a0d8
Author: Assaf Muller <email address hidden>
Date: Sun May 4 18:26:43 2014 +0300

    Change all occurences of no_delete to do_delete

    Previously, ports, networks and subnets had a do_delete=True
    parameter. By default, these resources were deleted at the
    end of the context manager scope. All other resources used
    a different semantic: no_delete=False.

    This caused confusing situations such as:
    with self.subnet(network, do_delete=False) as subnet:
        with self.security_group(no_delete=True) as sg:
            pass

    Now all resources use the same do_delete semantic.

    Closes-Bug: #1336196
    Change-Id: I4627481813f714819efe85831e2a55975ea71ed4

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