Custom Search

Saturday, February 22, 2014

How to Test OpenStack Keystone or Identity Deployment With Tempest

How to Test OpenStack Keystone or Identity Deployment With Tempest

1)
Install OpenStack using devstack and make it running
http://www.youtube.com/watch?v=AdrbYP7utDE

2)
#mkdir tempest_test
#cd tempest_test
#git clone https://github.com/openstack/tempest.git

#git checkout stable/branch_you_need



3)
You will get dependency errors when running following commands
#nosetests -v tempest

4)
Create virtualenv and install all dependencies
#./run_tempest.sh

5)
Activate virtualenv
#ls -a
#source .venv/bin/activate


6)
Find command help
#nosetests -v tempest --help

7)
Stop running tests after the first error or failure (use -x or --stop option)
#nosetests -vx tempest
or
#nosetests -v tempest --stop


8)

ConfigFilesNotFoundError: Failed to read some config files: /etc/tempest/tempest.conf

=============Solution/Fix================

a)
Goto
#cd tempest_test/tempest/etc
#vim tempest.conf.sample

Read "tempest.conf.sample" file and understand different config options

b)
Copy tempest.conf.sample to /etc/tempest/tempest.conf
#sudo mkdir /etc/tempest
#sudo cp tempest.conf.sample /etc/tempest/tempest.conf


9)
Run only the tests inside the module test_users.py
#nosetests -vx tempest.api.identity.admin.v3.test_users.py

10)
File "/home/saju/tempest_test/tempest/tempest/services/identity/json/identity_client.py", line 226, in __init__
    if 'tokens' not in auth_url:
TypeError: argument of type 'NoneType' is not iterable

=============Solution/Fix================

#sudo vim /etc/tempest/tempest.conf
[identity]
uri=http://127.0.0.1:5000/v2.0/


11)
Run only the tests inside the module test_users.py
#nosetests -vx tempest.api.identity.admin.v3.test_users.py

12)
  File "/home/saju/tempest_test/tempest/tempest/services/identity/v3/json/identity_client.py", line 448, in __init__
    raise exceptions.InvalidConfiguration('you must specify a v3 uri '
InvalidConfiguration: Invalid Configuration
Details: you must specify a v3 uri if using the v3 identity api

=============Solution/Fix================

#sudo vim /etc/tempest/tempest.conf
[identity]
uri=http://127.0.0.1:5000/v2.0/
uri_v3=http://127.0.0.1:5000/v3/


13)

Run only the tests inside the module test_users.py
#nosetests -vx tempest.api.identity.admin.v3.test_users.py

14)
  File "/home/saju/tempest_test/tempest/tempest/services/identity/json/identity_client.py", line 260, in request
    raise exceptions.Unauthorized(resp_body['error']['message'])
Unauthorized: Unauthorized
Details: Invalid user / password

-------------------- >> begin captured logging << --------------------
tempest.api.identity: DEBUG: Entering tempest.api.identity.setup_package
tempest.common.rest_client: INFO: Request: POST http://127.0.0.1:5000/v2.0/tokens
tempest.common.rest_client: DEBUG: Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
tempest.common.rest_client: DEBUG: Request Body: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "pass"}}} <==== IMP
tempest.common.rest_client: INFO: Response Status: 401
tempest.common.rest_client: DEBUG: Response Headers: {'content-length': '87', 'date': 'Sat, 22 Feb 2014 16:47:14 GMT', 'content-type': 'application/json', 'vary': 'X-Auth-Token', 'connection': 'close'}
tempest.common.rest_client: DEBUG: Response Body: {"error": {"message": "Invalid user / password", "code": 401, "title": "Unauthorized"}}
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 0.117s

FAILED (failures=1)

=============Solution/Fix================

[identity]
uri=http://127.0.0.1:5000/v2.0/
uri_v3=http://127.0.0.1:5000/v3/
admin_password=openstack

15)
(Working)

Run only the tests inside the module test_users.py
#nosetests -vx tempest.api.identity.admin.v3.test_users.py

16)
(Summary)

So, The minimum configuration to run identity tempest test

a)
#sudo vim /etc/tempest/tempest.conf
[identity]
uri=http://127.0.0.1:5000/v2.0/
uri_v3=http://127.0.0.1:5000/v3/
admin_password=openstack


OR

[identity]
uri=http://127.0.0.1:5000/v2.0/
uri_v3=http://127.0.0.1:5000/v3/
admin_username=admin

admin_tenant_name=admin
admin_password=openstack

b)
Run only the tests inside the module test_users.py
#nosetests -vx tempest.api.identity.admin.v3.test_users.py
OR
#nosetests -vx tempest.api.identity.admin.v3.test_users
OR
nosetests -vx tempest.api.identity.admin.v3.test_users.py:UsersV3TestJSON.test_list_user_projects
OR
nosetests -vx tempest.api.identity.admin.v3.test_users:UsersV3TestJSON.test_list_user_projects


======
Note:
-vxl 
x ---> Stop running tests after the first error or failure
l ---> Run test in Debug mode: So we can see better error message

1 comment:

  1. http://www.slideshare.net/openstackindia/introduction-to-tempest
    http://sagar-tech-gyan.blogspot.in/2012/04/testing-open-stack-with-devstack.html

    ReplyDelete