Comment 3 for bug 1770452

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

Reviewed: https://review.openstack.org/568390
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=1a8a15f6309a56087702a0974041fa9850de4f62
Submitter: Zuul
Branch: master

commit 1a8a15f6309a56087702a0974041fa9850de4f62
Author: Ihar Hrachyshka <email address hidden>
Date: Mon May 14 21:57:52 2018 +0000

    objects: avoid deepcopying models in test_db_obj

    SQLAlchemy may asynchronously push models out of session cache in which
    case we may receive DetachedInstanceError.

    In the test case, instead of deepcopying models to compare, compare
    each modified attribute independently.

    This change also includes conversion from InstrumentedLists to regular
    lists when converting model attributes to object fields. The fact that
    we were returning InstrumentedLists was always an oversight but it
    revealed itself after the modification of the test case that is the
    core of this patch.

    When converting object fields to db, convert Port's distributed_binding
    None value to a empty list to reflect that the relationship of the Port
    database model is a list. It was not an issue before the patch because
    we were not comparing model attribute for equality but for in-equality
    before, and so None was always != [].

    Finally, this patch moves a bunch of TODOs to better reflect where they
    belong to.

    Closes-Bug: #1770452
    Change-Id: I42cdf540129bd4470ec1a59345db9845a6198328