Getting ImportError: No module named functionaltests.common

Bug #1555624 reported by Penchal Reddy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Bhavna Saini

Bug Description

when i running functional test cases getting below error

(tempest)root@ubuntu1box:~/designate/functionaltests# testr run
running=python -m subunit.run discover ./api
======================================================================
FAIL: unittest2.loader._FailedTest.v2.test_recordset
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
ImportError: Failed to import test module: v2.test_recordset
Traceback (most recent call last):
  File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 456, in _find_test_path
    module = self._get_module_from_name(name)
  File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
    __import__(name)
  File "/root/designate/functionaltests/api/v2/test_recordset.py", line 19, in <module>
    from functionaltests.common import datagen
ImportError: No module named functionaltests.common

below are the envronment details that i am using

Designate stable/kilo
Tempest 10.0.0
Tempest-lib 1.0.0

Seems like there is a version related issue not sure which one will supoort for designate kilo.

Please fix it. Thanks.

Penchal Reddy (pr8721)
information type: Private Security → Public
Revision history for this message
Penchal Reddy (pr8721) wrote :
Download full text (10.4 KiB)

After i set python environment variable (export PYTHONPATH=/root/designate/) getting below error

2016-03-11 03:06:46.960 30037 INFO tempest [-] Using tempest config file /root/designate/functionaltests/tempest.conf
2016-03-11 03:06:46.995 30037 WARNING oslo_config.cfg [-] Option "lock_path" from group "DEFAULT" is deprecated. Use option "lock_path" from group "oslo_concurrency".
2016-03-11 03:06:46.995 30037 CRITICAL tempest [-] TypeError: credentials object is of type KeystoneV2Credentials, which is not a valid Credentials object type.
2016-03-11 03:06:46.995 30037 ERROR tempest Traceback (most recent call last):
2016-03-11 03:06:46.995 30037 ERROR tempest File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
2016-03-11 03:06:46.995 30037 ERROR tempest "__main__", fname, loader, pkg_name)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
2016-03-11 03:06:46.995 30037 ERROR tempest exec code in run_globals
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/lib/python2.7/site-packages/subunit/run.py", line 149, in <module>
2016-03-11 03:06:46.995 30037 ERROR tempest main()
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/lib/python2.7/site-packages/subunit/run.py", line 145, in main
2016-03-11 03:06:46.995 30037 ERROR tempest stdout=stdout, exit=False)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/testtools/run.py", line 171, in __init__
2016-03-11 03:06:46.995 30037 ERROR tempest self.parseArgs(argv)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/main.py", line 113, in parseArgs
2016-03-11 03:06:46.995 30037 ERROR tempest self._do_discovery(argv[2:])
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/testtools/run.py", line 211, in _do_discovery
2016-03-11 03:06:46.995 30037 ERROR tempest super(TestProgram, self)._do_discovery(argv, Loader=Loader)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/main.py", line 223, in _do_discovery
2016-03-11 03:06:46.995 30037 ERROR tempest self.test = loader.discover(self.start, self.pattern, self.top)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 367, in discover
2016-03-11 03:06:46.995 30037 ERROR tempest tests = list(self._find_tests(start_dir, pattern))
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 433, in _find_tests
2016-03-11 03:06:46.995 30037 ERROR tempest for test in path_tests:
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 424, in _find_tests
2016-03-11 03:06:46.995 30037 ERROR tempest full_path, pattern, namespace)
2016-03-11 03:06:46.995 30037 ERROR tempest File "/root/tempest/local/lib/python2.7/site-packages/unittest2/loader.py", line 480, in _find_test_path
2016-03-11 03:06:46.995 3...

affects: tempest → designate
Changed in designate:
assignee: nobody → Bhavna Saini (imbhavnasaini)
Revision history for this message
Bhavna Saini (imbhavnasaini) wrote :

Can you please share the steps you followed while creating the virtual environment for tempest or the steps to run these tests. Because in my environment I'm able to run these tests successfully.

Revision history for this message
Penchal Reddy (pr8721) wrote :

I used below commands to create virtualenv

virtualenv tempesttest

to activate that did source tempesttest/bin/activate

inside this virtual envronment i am running designate-api and designate-central services and then running below command to execute function testcases

(tempesttest)root@ubuntu1box:~/designate/functionaltests# testr run
running=python -m subunit.run discover ./api
/root/tempesttest/local/lib/python2.7/site-packages/tempest_lib/__init__.py:28: DeprecationWarning: tempest-lib is deprecated for future bug-fixes and code changes in favor of tempest. Please change your imports from tempest_lib to tempest.lib
  DeprecationWarning)
/root/tempesttest/local/lib/python2.7/site-packages/oslo_i18n/_message.py:21: ImportWarning: Not importing directory '/root/tempesttest/local/lib/python2.7/site-packages/oslo_i18n/locale': missing __init__.py
  import locale
======================================================================
FAIL: process-returncode
tags: worker-0
----------------------------------------------------------------------
returncode 1
Ran 1 (-1) tests
FAILED (id=161, failures=1 (-1))

Revision history for this message
Penchal Reddy (pr8721) wrote :

after all multiple attempts i got below error its saying object not found

(tempest)root@ubuntu1box:~/designate/functionaltests# testr run
running=python -m subunit.run discover ./api
/root/tempest/local/lib/python2.7/site-packages/tempest_lib/__init__.py:28: DeprecationWarning: tempest-lib is deprecated for future bug-fixes and code changes in favor of tempest. Please change your imports from tempest_lib to tempest.lib
  DeprecationWarning)
/root/tempest/local/lib/python2.7/site-packages/oslo_i18n/_message.py:21: ImportWarning: Not importing directory '/root/tempest/local/lib/python2.7/site-packages/oslo_i18n/locale': missing __init__.py
  import locale
======================================================================
FAIL: v2.test_recordset.RecordsetTest.test_crud_recordset_A
tags: worker-0
----------------------------------------------------------------------
pythonlogging:'': {{{2016-03-15 05:17:20,715 5970 INFO [tempest.lib.common.rest_client] Request (RecordsetTest:setUp): 404 PATCH http://135.75.169.111:9001/v1/admin/quotas/70a4596c9974429db5fb6fe240ab87b9 0.010s}}}

Traceback (most recent call last):
  File "/root/designate/functionaltests/api/v2/test_recordset.py", line 29, in setUp
    self.increase_quotas()
  File "/root/designate/functionaltests/api/v2/base.py", line 65, in increase_quotas
    'zone_recordsets': 9999999}}))
  File "/root/designate/functionaltests/api/v2/clients/quotas_client.py", line 39, in patch_quotas
    body=quotas_model.to_json(), **kwargs)
  File "/root/tempest/local/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 306, in patch
    return self.request('PATCH', url, extra_headers, headers, body)
  File "/root/tempest/local/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 642, in request
    resp, resp_body)
  File "/root/tempest/local/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 695, in _error_checker
    raise exceptions.NotFound(resp_body, resp=resp)
tempest.lib.exceptions.NotFound: Object not found
Details: {u'code': 404}

Revision history for this message
Penchal Reddy (pr8721) wrote :

Do we have admin quota APIs in kilo getting below in the logs

2016-03-15 08:02:17.987 11407 INFO eventlet.wsgi [-] (11407) accepted ('135.75.169.111', 55170)
2016-03-15 08:02:17.991 11407 INFO eventlet.wsgi [req-0c096b1f-d380-492c-95ba-a5a401d2cdc6 noauth-user noauth-project - - -] 135.75.169.111 - - [15/Mar/2016 08:02:17] "PATCH /admin/quotas/70a4596c9974429db5fb6fe240ab87b9 HTTP/1.1" 404 207 0.002368
2016-03-15 08:02:18.006 11407 INFO eventlet.wsgi [-] (11407) accepted ('135.75.169.111', 55171)
2016-03-15 08:02:18.009 11407 INFO eventlet.wsgi [req-2e10b247-1b6a-443b-bd49-8a82c57088ac noauth-user noauth-project - - -] 135.75.169.111 - - [15/Mar/2016 08:02:18] "PATCH /admin/quotas/70a4596c9974429db5fb6fe240ab87b9 HTTP/1.1" 404 207 0.001455

Even i tried individual API also still getting same

curl -i -X GET -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:9001/admin/quotas/70a4596c9974429db5fb6fe240ab87b9
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
X-Openstack-Request-Id: req-7b340681-7314-45bf-b682-608ca92a8848
Content-Length: 0
Date: Tue, 15 Mar 2016 13:03:29 GMT

in my conf i have enabled both below

enabled_extensions_admin = quotas
enabled_extensions_v1 = quotas, ...

V1 API is working fine

curl -i -X GET -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:9001/v1/quotas/70a4596c9974429db5fb6fe240ab87b9
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 99
X-Openstack-Request-Id: req-3fc4bf7f-3aac-4279-81b6-38fd39f87422
Date: Tue, 15 Mar 2016 13:03:20 GMT

{
  "domain_records": 500,
  "domain_recordsets": 500,
  "domains": 10,
  "recordset_records": 20
}

Revision history for this message
Penchal Reddy (pr8721) wrote :
Download full text (3.3 KiB)

DeprecationWarning: tempest-lib is deprecated for future bug-fixes and code changes in favor of tempest. Please change your imports from tempest_lib to tempest.lib this should be fixed in /designate/functionaltests/common/client.py file
otherwise we are receiving below error

2016-03-11 03:06:46.960 30037 INFO tempest [-] Using tempest config file /root/designate/functionaltests/tempest.conf
2016-03-11 03:06:46.995 30037 WARNING oslo_config.cfg [-] Option "lock_path" from group "DEFAULT" is deprecated. Use option "lock_path" from group "oslo_concurrency".
2016-03-11 03:06:46.995 30037 CRITICAL tempest [-] TypeError: credentials object is of type KeystoneV2Credentials, which is not a valid Credentials object type.

and one more thing is

This is working as expected but there is a issue or discrepancy in wiki page - http://docs.openstack.org/developer/designate/rest/admin/quotas.html as below -

1) configuration parameter "enable_api_admin" has to be enabled under "[service:api]" category
2) configuration parameter "enabled_extensions_admin" has to be added under "[service:api] category

Due to above lack of information in admin quotas wiki page, I observed the issues. for this there is a new bug opened seperately
https://bugs.launchpad.net/designate/+bug/1557576

now i am getting different issue i am able to run functional test cases but all the test cases are running multiple times and its taking more time due to this getting timeout error need to find out that

few of the logs are attached below

69.111:9001/v2/zones/25994830-51a4-426e-82ff-2f67b692a40f 0.049s
2016-03-17 03:22:39,090 10323 INFO [tempest.lib.common.rest_client] Request (ZoneTest:test_list_zones): 200 GET http://135.75.169.111:9001/v2/zones/25994830-51a4-426e-82ff-2f67b692a40f 0.050s
2016-03-17 03:22:40,139 10323 INFO [tempest.lib.common.rest_client] Request (ZoneTest:test_list_zones): 200 GET http://135.75.169.111:9001/v2/zones/25994830-51a4-426e-82ff-2f67b692a40f 0.046s
}}}

Traceback (most recent call last):
  File "/root/designate/functionaltests/api/v2/test_zone.py", line 35, in test_list_zones
    self._create_zone(datagen.random_zone_data())
  File "/root/designate/functionaltests/api/v2/test_zone.py", line 31, in _create_zone
    self.wait_for_zone(model.id)
  File "/root/designate/functionaltests/api/v2/base.py", line 35, in wait_for_zone
    self.wait_for_condition(lambda: self.is_zone_active(zone_id))
  File "/root/designate/functionaltests/common/base.py", line 36, in wait_for_condition
    raise Exception("Timed out after {0} seconds".format(timeout))
Exception: Timed out after 40 seconds
======================================================================
FAIL: v2.test_zone.ZoneTest.test_update_zone
tags: worker-0
----------------------------------------------------------------------
pythonlogging:'': {{{
2016-03-17 03:22:41,580 10323 INFO [tempest.lib.common.rest_client] Request (ZoneTest:setUp): 200 PATCH http://135.75.169.111:9001/admin/quotas/70a4596c9974429db5fb6fe240ab87b9 0.430s
2016-03-17 03:22:41,804 10323 INFO [tempest.lib.common.rest_client] Request (ZoneTest:test_update_zone): 202 POST http://135.75.169.111:9001/v2/zones 0.220s
2016...

Read more...

Changed in designate:
status: New → Invalid
Revision history for this message
Penchal Reddy (pr8721) wrote :

we have to fix below issue and fix is ready and ready to commit please accept

DeprecationWarning: tempest-lib is deprecated for future bug-fixes and code changes in favor of tempest. Please change your imports from tempest_lib to tempest.lib this should be fixed in /designate/functionaltests/common/client.py file
otherwise we are receiving below error

2016-03-11 03:06:46.960 30037 INFO tempest [-] Using tempest config file /root/designate/functionaltests/tempest.conf
2016-03-11 03:06:46.995 30037 WARNING oslo_config.cfg [-] Option "lock_path" from group "DEFAULT" is deprecated. Use option "lock_path" from group "oslo_concurrency".
2016-03-11 03:06:46.995 30037 CRITICAL tempest [-] TypeError: credentials object is of type KeystoneV2Credentials, which is not a valid Credentials object type.

Changed in designate:
status: Invalid → Fix Committed
Changed in designate:
status: Fix Committed → Fix Released
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.