DeprecatedDecorators test does not setup fixtures correctly

Bug #1474069 reported by Mike Bayer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Brant Knudson
oslo.log
Fix Released
Undecided
Brant Knudson

Bug Description

this test appears to rely upon test suite setup in a different test, outside of the test_backend_sql.py suite entirely. Below is a run of this specific test, but you get the same error if you run all of test_backend_sql at once as well.

[mbayer@thinkpad keystone]$ tox -v -e py27 keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api
using tox.ini: /home/mbayer/dev/jenkins_scripts/tmp/keystone/tox.ini
using tox-1.8.1 from /usr/lib/python2.7/site-packages/tox/__init__.pyc
py27 create: /home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27
  /home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox$ /usr/bin/python -mvirtualenv --setuptools --python /usr/bin/python2.7 py27 >/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/log/py27-0.log
py27 installdeps: -r/home/mbayer/dev/jenkins_scripts/tmp/keystone/requirements.txt, -r/home/mbayer/dev/jenkins_scripts/tmp/keystone/test-requirements.txt
  /home/mbayer/dev/jenkins_scripts/tmp/keystone$ /home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/bin/pip install -U -r/home/mbayer/dev/jenkins_scripts/tmp/keystone/requirements.txt -r/home/mbayer/dev/jenkins_scripts/tmp/keystone/test-requirements.txt >/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/log/py27-1.log
py27 develop-inst: /home/mbayer/dev/jenkins_scripts/tmp/keystone
  /home/mbayer/dev/jenkins_scripts/tmp/keystone$ /home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/bin/pip install -U -e /home/mbayer/dev/jenkins_scripts/tmp/keystone >/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/log/py27-2.log
py27 runtests: PYTHONHASHSEED='3819984772'
py27 runtests: commands[0] | bash tools/pretty_tox.sh keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api
  /home/mbayer/dev/jenkins_scripts/tmp/keystone$ /usr/bin/bash tools/pretty_tox.sh keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api
running testr
running=
OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystone/tests/unit} --list
running=
OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./keystone/tests/unit} --load-list /tmp/tmpclgNWA
{0} keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api [0.245028s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "keystone/tests/unit/test_backend_sql.py", line 995, in test_assignment_to_resource_api
        self.config_fixture.config(fatal_deprecations=True)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/fixture.py", line 65, in config
        self.conf.set_override(k, v, group)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 1823, in __inner
        result = f(self, *args, **kwargs)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 2100, in set_override
        opt_info = self._get_opt_info(name, group)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 2418, in _get_opt_info
        raise NoSuchOptError(opt_name, group)
    oslo_config.cfg.NoSuchOptError: no such option: fatal_deprecations

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
    Adding cache-proxy 'keystone.tests.unit.test_cache.CacheIsolatingProxy' to backend.
    registered 'sha512_crypt' handler: <class 'passlib.handlers.sha2_crypt.sha512_crypt'>

==============================
Failed 1 tests - output below:
==============================

keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api
-----------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "keystone/tests/unit/test_backend_sql.py", line 995, in test_assignment_to_resource_api
        self.config_fixture.config(fatal_deprecations=True)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/fixture.py", line 65, in config
        self.conf.set_override(k, v, group)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 1823, in __inner
        result = f(self, *args, **kwargs)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 2100, in set_override
        opt_info = self._get_opt_info(name, group)
      File "/home/mbayer/dev/jenkins_scripts/tmp/keystone/.tox/py27/lib/python2.7/site-packages/oslo_config/cfg.py", line 2418, in _get_opt_info
        raise NoSuchOptError(opt_name, group)
    oslo_config.cfg.NoSuchOptError: no such option: fatal_deprecations

Captured pythonlogging:
~~~~~~~~~~~~~~~~~~~~~~~
    Adding cache-proxy 'keystone.tests.unit.test_cache.CacheIsolatingProxy' to backend.
    registered 'sha512_crypt' handler: <class 'passlib.handlers.sha2_crypt.sha512_crypt'>

======
Totals
======
Ran: 1 tests in 3.0000 sec.
 - Passed: 0
 - Skipped: 0
 - Expected Fail: 0
 - Unexpected Success: 0
 - Failed: 1
Sum of execute time for each test: 0.2450 sec.

==============
Worker Balance
==============
 - Worker 0 (1 tests) => 0:00:00.245028s

Slowest Tests:

Test id Runtime (s)
----------------------------------------------------------------------------------------- -----------
keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api 0.245
ERROR: InvocationError: '/usr/bin/bash tools/pretty_tox.sh keystone.tests.unit.test_backend_sql.DeprecatedDecorators.test_assignment_to_resource_api'
_______________________________________________________________________ summary ________________________________________________________________________
ERROR: py27: commands failed

Revision history for this message
Mike Bayer (zzzeek) wrote :

something about "assignment_api" makes this work, but tracing around there is way too much going on for me to find it. the token "fatal_deprecations" appears nowhwere else in the entire application so I have no idea how oslo_config is changing its mind about this parameter:

diff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py
index ec64f03..8ca7e0f 100644
--- a/keystone/tests/unit/test_backend_sql.py
+++ b/keystone/tests/unit/test_backend_sql.py
@@ -983,6 +983,11 @@ class DeprecatedDecorators(SqlTests):

         # First try to create a project without enabling fatal deprecations,
         # which should work due to the cross manager deprecated calls.
+ role_ref = {
+ 'id': uuid.uuid4().hex,
+ 'name': uuid.uuid4().hex}
+ self.assignment_api.create_role(role_ref['id'], role_ref)
+
         project_ref = {
             'id': uuid.uuid4().hex,
             'name': uuid.uuid4().hex,

Brant Knudson (blk-u)
Changed in keystone:
status: New → Confirmed
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
tags: added: test-improvement
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
assignee: nobody → Brant Knudson (blk-u)
status: Confirmed → In Progress
Revision history for this message
Dolph Mathews (dolph) wrote :

While investigating this bug, I discovered two similar failures in keystone, and filed bug 1474490 and bug 1474491 accordingly. Neither appear to share a root cause with this failure.

Brant Knudson (blk-u)
Changed in oslo.log:
assignee: nobody → Brant Knudson (blk-u)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.log (master)

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

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

Reviewed: https://review.openstack.org/201352
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=44c241e18c25e230d5afe0a299c2c7bc418fbb8b
Submitter: Jenkins
Branch: master

commit 44c241e18c25e230d5afe0a299c2c7bc418fbb8b
Author: Brant Knudson <email address hidden>
Date: Mon Jul 13 16:57:40 2015 -0500

    Register fatal_deprecations before use

    The keystone.tests.unit.test_backend_sql.DeprecatedDecorators
    tests would fail when run individually with an error

     oslo_config.cfg.NoSuchOptError: no such option: fatal_deprecations

    This is because the way that fatal_deprecations gets registered is
    when versionutils.report_deprecated_feature() is called.

    The fix is to call versionutils.report_deprecated_feature() before
    trying to set the fatal_deprecations option.

    Change-Id: I6ad2dd0a47f00ea2ba05d587e0291230e789f057
    Closes-Bug: 1474069

Changed in keystone:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.log (master)

Reviewed: https://review.openstack.org/210504
Committed: https://git.openstack.org/cgit/openstack/oslo.log/commit/?id=54bc7f2c925d7e66818a98b45622c68d15711fe8
Submitter: Jenkins
Branch: master

commit 54bc7f2c925d7e66818a98b45622c68d15711fe8
Author: Brant Knudson <email address hidden>
Date: Fri Aug 7 10:43:28 2015 -0500

    Provide a way to register versionutils options

    The versionutils functions will register their options when they're
    first called, but this forces applications to call the function in
    order to be able to override the option.

    A new function is added to register the options independently of
    calling the existing functions.

    Change-Id: I0f3f4cf0f42fefcb9773a00c1437380b9fd8f21b
    Closes-Bug: 1474069

Changed in oslo.log:
status: In Progress → Fix Committed
Changed in oslo.log:
milestone: none → 1.9.0
status: Fix Committed → Fix Released
Changed in keystone:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: liberty-3 → 8.0.0
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.