murano.tests.unit.db.services.test_instances.TestInstances.test_track_instance_except_duplicate_entry fails

Bug #1938676 reported by Takashi Kajinami
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Murano
Fix Released
Undecided
Unassigned

Bug Description

Currently the following test in unit tests is continuously failing and blocking the gate.

murano.tests.unit.db.services.test_instances.TestInstances.test_track_instance_except_duplicate_entry
-----------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/home/tkajinam/git/openstack/murano/murano/db/services/instances.py", line 49, in track_instance
    unit.add(instance)

      File "/usr/lib64/python3.8/unittest/mock.py", line 1081, in __call__
    return self._mock_call(*args, **kwargs)

      File "/usr/lib64/python3.8/unittest/mock.py", line 1085, in _mock_call
    return self._execute_mock_call(*args, **kwargs)

      File "/usr/lib64/python3.8/unittest/mock.py", line 1140, in _execute_mock_call
    raise effect

    oslo_db.exception.DBDuplicateEntry: None

During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 182, in expect
    resolved = insp.__clause_element__()

      File "/usr/lib64/python3.8/unittest/mock.py", line 639, in __getattr__
    raise AttributeError(name)

    AttributeError: __clause_element__

During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

      File "/usr/lib64/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)

      File "/home/tkajinam/git/openstack/murano/murano/tests/unit/db/services/test_instances.py", line 63, in test_track_instance_except_duplicate_entry
    track_instance('test_instance_id', 'test_env_id', 'test_type',

      File "/home/tkajinam/git/openstack/murano/murano/db/services/instances.py", line 52, in track_instance
    sqlalchemy.update(models.Instance).where(

      File "<string>", line 2, in update

      File "<string>", line 2, in __init__

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 298, in warned
    return fn(*args, **kwargs)

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/dml.py", line 1277, in __init__
    super(Update, self).__init__(table, values, prefixes)

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/dml.py", line 494, in __init__
    self.table = coercions.expect(

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 184, in expect
    impl._raise_for_expected(original_element, argname)

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 437, in _raise_for_expected
    return super(_SelectIsNotFrom, self)._raise_for_expected(

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 283, in _raise_for_expected
    util.raise_(exc.ArgumentError(msg, code=code), replace_context=err)

      File "/home/tkajinam/git/openstack/murano/.tox/py38/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception

    sqlalchemy.exc.ArgumentError: subject table for an INSERT, UPDATE or DELETE expected, got <MagicMock name='models.Instance' id='139971461688240'>.

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/murano/+/803151

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

Reviewed: https://review.opendev.org/c/openstack/murano/+/803151
Committed: https://opendev.org/openstack/murano/commit/2800f0b62c2936cd68c35623010c3f57d58b975d
Submitter: "Zuul (22348)"
Branch: master

commit 2800f0b62c2936cd68c35623010c3f57d58b975d
Author: Takashi Kajinami <email address hidden>
Date: Mon Aug 2 17:20:27 2021 +0900

    Fix broken unit test

    This change mocks sqlalchemy.update during unit tests properly to avoid
    the following error.

    sqlalchemy.exc.ArgumentError: subject table for an INSERT, UPDATE or
    DELETE expected, got <MagicMock name='models.Instance' id='...'>

    Closes-Bug: #1938676
    Change-Id: I5268132018e0a283bd35b5599cf8ca41968dde93

Changed in murano:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/murano/+/805513

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/murano/+/805514

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/murano/+/805513
Committed: https://opendev.org/openstack/murano/commit/623d6b49a086fd4fe2d4bdc40720522905ca3a47
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 623d6b49a086fd4fe2d4bdc40720522905ca3a47
Author: Takashi Kajinami <email address hidden>
Date: Mon Aug 2 17:20:27 2021 +0900

    Fix broken unit test

    This change mocks sqlalchemy.update during unit tests properly to avoid
    the following error.

    sqlalchemy.exc.ArgumentError: subject table for an INSERT, UPDATE or
    DELETE expected, got <MagicMock name='models.Instance' id='...'>

    Closes-Bug: #1938676
    Change-Id: I5268132018e0a283bd35b5599cf8ca41968dde93
    (cherry picked from commit 2800f0b62c2936cd68c35623010c3f57d58b975d)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/murano 12.0.0.0rc1

This issue was fixed in the openstack/murano 12.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/murano/+/805514
Committed: https://opendev.org/openstack/murano/commit/8ec727dfc6bbfba3a9f1260110b0297c557e1295
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 8ec727dfc6bbfba3a9f1260110b0297c557e1295
Author: Takashi Kajinami <email address hidden>
Date: Mon Aug 2 17:20:27 2021 +0900

    Fix broken unit test

    This change mocks sqlalchemy.update during unit tests properly to avoid
    the following error.

    sqlalchemy.exc.ArgumentError: subject table for an INSERT, UPDATE or
    DELETE expected, got <MagicMock name='models.Instance' id='...'>

    Closes-Bug: #1938676
    Change-Id: I5268132018e0a283bd35b5599cf8ca41968dde93
    (cherry picked from commit 2800f0b62c2936cd68c35623010c3f57d58b975d)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/murano victoria-eol

This issue was fixed in the openstack/murano victoria-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/murano wallaby-eol

This issue was fixed in the openstack/murano wallaby-eol release.

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.