testr list-tests fails if compute service is absent in a stack

Bug #1405797 reported by Andrii Ostapenko
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released
Matthew Treinish

Bug Description

testr list-tests will fail if you provide username and password in identity group and compute service is not present in a stack

user@ubuntu:/opt/stack/tempest$ testr list-tests
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tempest/test_discover} --list
--- import errors ---
Failed to call load_tests:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/unittest2/loader.py", line 136, in loadTestsFromModule
    return load_tests(self, tests, pattern)
  File "tempest/scenario/utils.py", line 157, in load_tests_input_scenario_utils
    scenario_flavor = scenario_utils.scenario_flavors
  File "tempest/scenario/utils.py", line 137, in scenario_flavors
    _, flavors = self.flavors_client.list_flavors()
  File "tempest/services/compute/json/flavors_client.py", line 41, in list_flavors
    resp, body = self.get(url)
  File "tempest/common/rest_client.py", line 239, in get
    return self.request('GET', url, extra_headers, headers)
  File "tempest/common/rest_client.py", line 437, in request
    headers=headers, body=body)
  File "tempest/common/rest_client.py", line 402, in _request
    method, url, headers, body, self.filters)
  File "tempest/auth.py", line 150, in auth_request
    filters, method, url, headers, body)
  File "tempest/auth.py", line 213, in _decorate_request
    base_url = self.base_url(filters=filters, auth_data=auth_data)
  File "tempest/auth.py", line 306, in base_url
    raise exceptions.EndpointNotFound(service)
EndpointNotFound: Endpoint not found
Details: compute
Non-zero exit code (2) from test listing.

Revision history for this message
Monica (mraj) wrote :

This issue results in me being unable to run tempest tox py27 tests unless I also have a devstack running. Prior to this issue I had tempest py27 running as a part of a continuous integration system that ran the py27 tests of all modules without starting up devstack for this purpose.

Revision history for this message
Mauro S M Rodrigues (maurosr) wrote :

Hi, both 'testr list-tests' and 'tox -epy27' work fine for me with *no stack running*.. Are you sure you've sourced the .tox/py27/bin/activate to have a complete environment to run such tests? Can you also try with the latest tempest?

Changed in tempest:
status: New → Incomplete
Revision history for this message
Monica (mraj) wrote :

I have the latest tempest and I still see this issue.

If I want to check testr list-tests output, I activate the tox/py27 virtual env and then run testr list-tests and I still see the error. When running the tox -epy27 target, I do not activate .tox/py27/virtualenv beforehand because I expect tox to take care of this. Both these commands fail when stack is not running and succeed when stack is running.

The problem is with test_server_basic_ops.py. At the top of this file there is a call to a function called 'load_tests_input_scenario_utils' that queries nova for all flavors. This line gets executed anytime the test_server_basic_ops file is imported.

Revision history for this message
Monica (mraj) wrote :

During the tests base_url method in tempest/tempest/auth.py gets called. This is where the error occurs. The base_url method is overridden by a few different auth provide classes. When I run my code the base_url method defined in KeystoneV2AuthProvider gets called.

Revision history for this message
Matthew Treinish (treinish) wrote :

I've confirmed this bug. The title isn't entirely accurate which I think is the confusion here. The simple reproduce is with devstack. Just run ./stack.sh followed by ./unstack.sh then if you run testr list or the unit tests things will stack trace. The reason for this is understandable considering how we use config at import time.

Changed in tempest:
assignee: nobody → Matthew Treinish (treinish)
importance: Undecided → High
status: Incomplete → Triaged
Revision history for this message
Matthew Treinish (treinish) wrote :

I should clarify that previous comment by saying how we use import for the testscenario utils module in the scenario tests.

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/157064

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

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

commit 67e570c7fe2a1520c33aeba6f69492c15b9c3a3b
Author: Matthew Treinish <email address hidden>
Date: Wed Feb 18 16:59:39 2015 +0000

    Handle errors listing flavors and images in scenario utils

    This commit adds a try except block around the api calls made during
    the scenario tests' testscenario utils module. This is needed because
    if a config file is present but has incorrect information the errors
    raised will cause import failures during discovery. This will cause
    test list (or any other operation which involves test discovery) to

    Change-Id: I8f31abcba547be78fc2dc9250f522bb6ac14cb01
    Closes-Bug: #1405797

Changed in tempest:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers