Lots of tests mix local and instance variables

Bug #1482299 reported by Matthew Treinish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Low
Brandon Palm

Bug Description

A lot of tempest tests use instance variables for no reason when they're being treated as a local. This causes problems down the road because following the code is difficult to trace trough and there are unexpected results from multiple tests being run in the same class. We should only use instance variables when something truly needs to be used between 2 classes, like a resource tracking list.

An example of this is:

http://git.openstack.org/cgit/openstack/tempest/tree/tempest/api/network/test_routers.py

look at the use of self.router

For some reason neutron tests and scenario tests in particular seem to be the worst offenders for doing this. But they are not alone. We really need some one to go through and clean these all up.

Brandon Palm (bapalm)
Changed in tempest:
assignee: nobody → Brandon Palm (bapalm)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

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

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

Reviewed: https://review.openstack.org/211138
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=f35aa8b3aff60c0f8cf2b53578cd27c196801deb
Submitter: Jenkins
Branch: master

commit f35aa8b3aff60c0f8cf2b53578cd27c196801deb
Author: Brandon Palm <email address hidden>
Date: Fri Aug 7 14:56:59 2015 -0500

    Cleaned up class variable scope issue.

    self.router was used as a local variable to a few functions.

    Change-Id: I3d6aa0731a227c255ad9966ea3c5052a2fa4898d
    Closes-Bug: #1482299

Changed in tempest:
status: In Progress → Fix Released
Changed in tempest:
status: Fix Released → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/219382

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tempest (master)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: master
Review: https://review.openstack.org/219382
Reason: abd154c87a75bd4100bfe72c2ed3f5d31d5cf0a2 kind of messes this up since the timestamp methods are now in the base class and they don't allow passing the keypair in, so they implicitly rely on self.keypair being set for ssh. I'll rework this on it's own in a separate change.

Matt Riedemann (mriedem)
Changed in tempest:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/229648

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/229655

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/234780

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tempest (master)

Reviewed: https://review.openstack.org/219382
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=fd5657deddf551d33461a8bdd3328b1b7c8658fa
Submitter: Jenkins
Branch: master

commit fd5657deddf551d33461a8bdd3328b1b7c8658fa
Author: Matt Riedemann <email address hidden>
Date: Wed Sep 30 14:47:07 2015 -0700

    test_stamp_pattern: cleanup class scope variable usage

    This removes the class variables for keypair and security group
    so we don't rely on tight coupling between method calls.

    Change-Id: I24149494a42c3c2988c1f6b9ef9b8541ed65dc06
    Related-Bug: #1482299

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/229648
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=73764bf6eca76d2b603a614d2576e13685ba7a91
Submitter: Jenkins
Branch: master

commit 73764bf6eca76d2b603a614d2576e13685ba7a91
Author: Matt Riedemann <email address hidden>
Date: Wed Sep 30 14:53:25 2015 -0700

    test_shelve_instance: cleanup class scope variable usage

    This removes the class variables for keypair and security group
    so we don't rely on tight coupling between method calls.

    Change-Id: I8cdec35cbf3ca168c3d9979a771caa7221d4b511
    Related-Bug: #1482299

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/229655
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=c5bb7663b618a91b15d379fb5b2550e238566ce6
Submitter: Jenkins
Branch: master

commit c5bb7663b618a91b15d379fb5b2550e238566ce6
Author: Matt Riedemann <email address hidden>
Date: Wed Sep 30 14:57:22 2015 -0700

    test_snapshot_pattern: cleanup class scope variable usage

    This removes the class variables for keypair and security group
    so we don't rely on tight coupling between method calls.

    Change-Id: I0888aae97ab134601fae824d7af017da4318d669
    Related-Bug: #1482299

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/234780
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=7cf6476cd95e80d1ba29bf3816835f5a07ac3230
Submitter: Jenkins
Branch: master

commit 7cf6476cd95e80d1ba29bf3816835f5a07ac3230
Author: Jordan Pittier <email address hidden>
Date: Wed Oct 14 15:01:12 2015 +0200

    test_minimum_basic: cleanup class scope variable usage

    This removes the class variables for 'server' and 'volume'
    so we don't rely on tight coupling between method calls.

    Change-Id: If3917afa161cdbdd695a7fc80952f54d524d221b
    Related-Bug: #1482299

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tempest (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/248136

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tempest (master)

Reviewed: https://review.openstack.org/248136
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=1e443ecffde5fe9a1a98252fc95b1ef5103ff0f8
Submitter: Jenkins
Branch: master

commit 1e443ecffde5fe9a1a98252fc95b1ef5103ff0f8
Author: Jordan Pittier <email address hidden>
Date: Fri Nov 20 16:15:58 2015 +0100

    Scenarios: cleanup class scope variable usage

    This removes the class variables for 'server', 'volume' and 'image'
    so we don't rely on tight coupling between method calls.

    Related-Bug: #1482299
    Change-Id: I03aa4e4e4dab9ad9e41175f493fc4535b8dd0f2c

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.