Misuse of nova.objects.base.obj_equal_prims in tests

Bug #1839853 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Takashi Natsume
Ocata
In Progress
Medium
Unassigned
Pike
Fix Released
Medium
Takashi Natsume
Queens
Fix Committed
Medium
Takashi Natsume
Rocky
Fix Committed
Medium
Takashi Natsume
Stein
Fix Committed
Medium
Takashi Natsume

Bug Description

There are some tests, mostly related to BuildRequest objects, that are calling nova.objects.base.obj_equal_prims which does not assert anything, it only returns True or False - the test code itself must assert the expected result of the obj_equal_prims method.

https://github.com/openstack/nova/blob/ab34c941be28f3486cd2699af8d9237e9edac351/nova/tests/functional/db/test_build_request.py

https://github.com/openstack/nova/blob/d89579a66ac38fd1e30cea55306e6e7b69bab5b9/nova/tests/unit/objects/test_build_request.py

Revision history for this message
Matt Riedemann (mriedem) wrote :

I'm assuming all of the calls to that method should be wrapped in an assertTrue statement.

Changed in nova:
status: New → Confirmed
tags: added: testing
Changed in nova:
importance: Undecided → Medium
tags: added: low-hanging-fruit
Changed in nova:
assignee: nobody → Takashi NATSUME (natsume-takashi)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/676030

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

Reviewed: https://review.opendev.org/676030
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5c1d9dcbb29f5a84d56c4e496b3111b4040cad13
Submitter: Zuul
Branch: master

commit 5c1d9dcbb29f5a84d56c4e496b3111b4040cad13
Author: Takashi NATSUME <email address hidden>
Date: Tue Aug 13 09:31:32 2019 +0900

    Fix misuse of nova.objects.base.obj_equal_prims

    The nova.objects.base.obj_equal_prims returns True or False.
    It does not assert anything.
    So the return value should be asserted in tests.

    Add assertTrue where the nova.objects.base.obj_equal_prims is called.

    Change-Id: I49460ec3b572ee14b32229e771a5499ff91e8722
    Closes-Bug: #1839853

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

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/676289

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

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/676290

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

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/676291

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

Fix proposed to branch: stable/pike
Review: https://review.opendev.org/676292

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

Fix proposed to branch: stable/ocata
Review: https://review.opendev.org/676295

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

Reviewed: https://review.opendev.org/676289
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a8e19afb3d4889412ee6f539bb63865eb8ef5bb5
Submitter: Zuul
Branch: stable/stein

commit a8e19afb3d4889412ee6f539bb63865eb8ef5bb5
Author: Takashi NATSUME <email address hidden>
Date: Tue Aug 13 09:31:32 2019 +0900

    Fix misuse of nova.objects.base.obj_equal_prims

    The nova.objects.base.obj_equal_prims returns True or False.
    It does not assert anything.
    So the return value should be asserted in tests.

    Add assertTrue where the nova.objects.base.obj_equal_prims is called.

    Change-Id: I49460ec3b572ee14b32229e771a5499ff91e8722
    Closes-Bug: #1839853
    (cherry picked from commit 5c1d9dcbb29f5a84d56c4e496b3111b4040cad13)

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

Reviewed: https://review.opendev.org/676290
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a17bb97b2eb1f8657423f2ecbbfbfb9b1b629ae7
Submitter: Zuul
Branch: stable/rocky

commit a17bb97b2eb1f8657423f2ecbbfbfb9b1b629ae7
Author: Takashi NATSUME <email address hidden>
Date: Tue Aug 13 09:31:32 2019 +0900

    Fix misuse of nova.objects.base.obj_equal_prims

    The nova.objects.base.obj_equal_prims returns True or False.
    It does not assert anything.
    So the return value should be asserted in tests.

    Add assertTrue where the nova.objects.base.obj_equal_prims is called.

    Change-Id: I49460ec3b572ee14b32229e771a5499ff91e8722
    Closes-Bug: #1839853
    (cherry picked from commit 5c1d9dcbb29f5a84d56c4e496b3111b4040cad13)
    (cherry picked from commit a8e19afb3d4889412ee6f539bb63865eb8ef5bb5)

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

Reviewed: https://review.opendev.org/676291
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=151c828b1f498d44342d9265e575e5fdcb0783c1
Submitter: Zuul
Branch: stable/queens

commit 151c828b1f498d44342d9265e575e5fdcb0783c1
Author: Takashi NATSUME <email address hidden>
Date: Tue Aug 13 09:31:32 2019 +0900

    Fix misuse of nova.objects.base.obj_equal_prims

    The nova.objects.base.obj_equal_prims returns True or False.
    It does not assert anything.
    So the return value should be asserted in tests.

    Add assertTrue where the nova.objects.base.obj_equal_prims is called.

    Change-Id: I49460ec3b572ee14b32229e771a5499ff91e8722
    Closes-Bug: #1839853
    (cherry picked from commit 5c1d9dcbb29f5a84d56c4e496b3111b4040cad13)
    (cherry picked from commit a8e19afb3d4889412ee6f539bb63865eb8ef5bb5)
    (cherry picked from commit a17bb97b2eb1f8657423f2ecbbfbfb9b1b629ae7)

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

Reviewed: https://review.opendev.org/676292
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a926d356d08ad4b00c0e810053b20bfd9c46ac41
Submitter: Zuul
Branch: stable/pike

commit a926d356d08ad4b00c0e810053b20bfd9c46ac41
Author: Takashi NATSUME <email address hidden>
Date: Tue Aug 13 09:31:32 2019 +0900

    Fix misuse of nova.objects.base.obj_equal_prims

    The nova.objects.base.obj_equal_prims returns True or False.
    It does not assert anything.
    So the return value should be asserted in tests.

    Add assertTrue where the nova.objects.base.obj_equal_prims is called.

    Change-Id: I49460ec3b572ee14b32229e771a5499ff91e8722
    Closes-Bug: #1839853
    (cherry picked from commit 5c1d9dcbb29f5a84d56c4e496b3111b4040cad13)
    (cherry picked from commit a8e19afb3d4889412ee6f539bb63865eb8ef5bb5)
    (cherry picked from commit a17bb97b2eb1f8657423f2ecbbfbfb9b1b629ae7)
    (cherry picked from commit 151c828b1f498d44342d9265e575e5fdcb0783c1)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 20.0.0.0rc1

This issue was fixed in the openstack/nova 20.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 19.0.3

This issue was fixed in the openstack/nova 19.0.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.2.3

This issue was fixed in the openstack/nova 18.2.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.13

This issue was fixed in the openstack/nova 17.0.13 release.

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

This issue was fixed in the openstack/nova pike-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.