← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1679794] Re: test_show_router_attribute_with_timestamp can fail in certain environments

 

Reviewed:  https://review.openstack.org/453285
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9b31b388a83d6cd1746f5698c811943a08263015
Submitter: Jenkins
Branch:    master

commit 9b31b388a83d6cd1746f5698c811943a08263015
Author: Brian Haley <bhaley@xxxxxxxxxx>
Date:   Tue Apr 4 14:10:12 2017 -0400

    Fix tempest router timestamp test when HA enabled
    
    When run in an HA or DVR configured environment,
    the test_show_router_attribute_with_timestamp API
    test can fail with an 'updated_at' timestamp mismatch.
    
    The test should check if the timestamp is >= since
    post-creation code could update the object.
    
    Closes-bug: #1679794
    
    Change-Id: I3c58af022d1699ab05ca964b6d957dae39cf1ccc


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1679794

Title:
  test_show_router_attribute_with_timestamp can fail in certain
  environments

Status in neutron:
  Fix Released

Bug description:
  When running in an HA or DVR configured environment, the following
  tempest API test can fail with an 'updated_at' timestamp mismatch:

  neutron.tests.tempest.api.test_timestamp.TestTimeStampWithL3.test_show_router_attribute_with_timestamp

  In the HA case, the problem is that the create_router() code in
  l3_hamode_db.py looks like this:

          router_dict = super(L3_HA_NAT_db_mixin,
                              self).create_router(context, router)
          if is_ha:
              try:
                  router_db = self._get_router(context, router_dict['id'])

                  self.schedule_router(context, router_dict['id'])

                  router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
                  router_dict['status'] = self._update_router_db(
                      context, router_dict['id'],
                      {'status': n_const.ROUTER_STATUS_ACTIVE})['status']
                  self._notify_router_updated(context, router_db.id,
                                              schedule_routers=False)

  Since a vr_id is allocated, the router DB entry is updated with that
  info right after it was created.  The original POST call is returning
  what is essentially "stale" data.  A subsequent get will show a
  changes 'updated_at' field.

  You can see this if you create a router with --ha in a one-node
  devstack:

  (admin) $ openstack router create --ha --project
  ae5c9703507546f5801a14ddb124d47e router3

  $ openstack router show router3
  +-------------------------+--------------------------------------+
  | Field                   | Value                                |
  +-------------------------+--------------------------------------+
  | admin_state_up          | UP                                   |
  | availability_zone_hints |                                      |
  | availability_zones      | nova                                 |
  | created_at              | 2017-04-03T16:01:43Z                 |
  | description             |                                      |
  | distributed             | False                                |
  | external_gateway_info   | None                                 |
  | flavor_id               | None                                 |
  | ha                      | False                                |
  | id                      | 08ec51fb-188e-460a-bb01-61ddf160b77c |
  | name                    | router3                              |
  | project_id              | ae5c9703507546f5801a14ddb124d47e     |
  | revision_number         | 5                                    |
  | routes                  |                                      |
  | status                  | ACTIVE                               |
  | updated_at              | 2017-04-03T16:01:44Z                 |
  +-------------------------+--------------------------------------+

  The 'updated_at' timestamp is +1s from 'created_at'.

  The test should check >= instead.  The same problem would happen with
  DVR.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1679794/+subscriptions


References