functional test fails with SDKException

Bug #1634969 reported by Choe, Cheng-Dae
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
New
Undecided
Unassigned

Bug Description

$ tox -e functional

Failed to import test module: openstack.tests.functional.telemetry.v2.test_statistics
Traceback (most recent call last):
  File "/Users/charlie/work/openstack/python-openstacksdk/.tox/functional/lib/python2.7/site-packages/unittest2/loader.py", line 456, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/charlie/work/openstack/python-openstacksdk/.tox/functional/lib/python2.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
    __import__(name)
  File "openstack/tests/functional/telemetry/v2/test_statistics.py", line 18, in <module>
    @unittest.skipUnless(base.service_exists(service_type="metering"),
  File "openstack/tests/functional/base.py", line 63, in service_exists
    conn.session.get_endpoint(**kwargs)
  File "openstack/session.py", line 238, in get_endpoint
    sc_endpoint)
  File "openstack/session.py", line 123, in _get_endpoint_versions
    response = self.get(root_endpoint)
  File "/Users/charlie/work/openstack/python-openstacksdk/.tox/functional/lib/python2.7/site-packages/keystoneauth1/session.py", line 667, in get
    return self.request(url, 'GET', **kwargs)
  File "openstack/session.py", line 54, in map_exceptions_wrapper
    raise exceptions.SDKException(message=e.message, cause=e)
SDKException: Connection failure that may be retried.
The test run didn't actually run any tests

I'm trying to functional test with trystack.org. but ceilometer endpoint gets connection failure.

here is just simple path for just skip test when endpoint connection failed. but I'm not sure it is a right solution.

diff --git a/openstack/tests/functional/base.py b/openstack/tests/functional/base.py
index 3d37081..ec168b3 100644
--- a/openstack/tests/functional/base.py
+++ b/openstack/tests/functional/base.py
@@ -17,6 +17,7 @@ import unittest

 from keystoneauth1 import exceptions as _exceptions
 from openstack import connection
+from openstack import exceptions

 #: Defines the OpenStack Client Config (OCC) cloud key in your OCC config
@@ -65,6 +66,10 @@ def service_exists(**kwargs):
         return True
     except _exceptions.EndpointNotFound:
         return False
+ except exceptions.SDKException as e:
+ if isinstance(e.cause, _exceptions.connection.ConnectFailure):
+ return False
+ raise

 class BaseFunctionalTest(unittest.TestCase):

description: updated
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.