add vapor tests
Change-Id: I4d212551fe01795e2d1ee379ffc203fcc6cc7221
This commit is contained in:
parent
96ff051769
commit
3aa0d199ab
|
@ -1,9 +0,0 @@
|
|||
|
||||
PATH_TO_CERT = '/tmp/cert.crt'
|
||||
VERIFY_SSL = False
|
||||
DISABLE_SSL = False
|
||||
KEYSTONE_CREDS = {
|
||||
'username': 'admin',
|
||||
'password': 'admin',
|
||||
'tenant_name': 'admin',
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
keystoneauth1
|
||||
pytest
|
|
@ -0,0 +1,11 @@
|
|||
Vapor
|
||||
=====
|
||||
|
||||
Open Stack Contrail plugin test suite
|
||||
|
||||
Run tests
|
||||
---------
|
||||
.. code:: bash
|
||||
|
||||
>> tox
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# OpenStack credentials:
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD=secret
|
||||
export OS_TENANT_NAME=admin
|
||||
export OS_AUTH_URL=http://127.0.0.1:5000/v2.0
|
||||
|
||||
#export OS_PROJECT_DOMAIN_NAME=default
|
||||
#export OS_USER_DOMAIN_NAME=default
|
||||
#export OS_PROJECT_NAME=admin
|
|
@ -0,0 +1,8 @@
|
|||
# content of pytest.ini
|
||||
[pytest]
|
||||
markers =
|
||||
smoke_test: mark test as Smoke.
|
||||
performance_test: mark test as Performance.
|
||||
|
||||
#addopts = -vv --color=yes --junit-xml=report.xml
|
||||
addopts = -vv --color=yes
|
|
@ -0,0 +1,103 @@
|
|||
git+https://github.com/Mirantis/stepler.git
|
||||
keystoneauth1
|
||||
pytest
|
||||
git+https://github.com/morganfainberg/positional.git
|
||||
|
||||
AllPairs==2.0.1
|
||||
ansible==2.2.0.0
|
||||
anyjson==0.3.3
|
||||
apipkg==1.4
|
||||
appdirs==1.4.0
|
||||
attrdict==2.0.0
|
||||
Babel==2.3.4
|
||||
beautifulsoup4==4.5.1
|
||||
cffi==1.9.1
|
||||
cliff==2.3.0
|
||||
cmd2==0.6.9
|
||||
cryptography==1.7
|
||||
debtcollector==1.10.0
|
||||
docutils==0.13.1
|
||||
enum34==1.1.6
|
||||
execnet==1.4.1
|
||||
funcsigs==1.0.2
|
||||
functools32==3.2.3.post2
|
||||
httplib2==0.9.2
|
||||
idna==2.1
|
||||
imagesize==0.7.1
|
||||
ipaddress==1.0.17
|
||||
ipdb==0.10.1
|
||||
ipython==5.1.0
|
||||
iso8601==0.1.11
|
||||
Jinja2==2.8
|
||||
joblib==0.10.3
|
||||
jsonpatch==1.14
|
||||
jsonpointer==1.10
|
||||
jsonschema==2.5.1
|
||||
junitxml==0.7
|
||||
keyring==10.1
|
||||
launchpadlib==1.10.4
|
||||
lazr.authentication==0.1.3
|
||||
lazr.restfulclient==0.13.1
|
||||
lazr.uri==1.0.3
|
||||
MarkupSafe==0.23
|
||||
mock==2.0.0
|
||||
monotonic==1.2
|
||||
msgpack-python==0.4.8
|
||||
netaddr==0.7.18
|
||||
netifaces==0.10.5
|
||||
nose==1.2.1
|
||||
oauth==1.0.1
|
||||
os-faults==0.1.8
|
||||
oslo.config==3.21.0
|
||||
oslo.i18n==3.11.0
|
||||
oslo.serialization==2.15.0
|
||||
oslo.utils==3.20.0
|
||||
oslosphinx==4.7.0
|
||||
paramiko==2.0.2
|
||||
pbr==1.10.0
|
||||
prettytable==0.7.2
|
||||
proboscis==1.2.6.0
|
||||
py==1.4.31
|
||||
pyaml==16.9.0
|
||||
pyasn1==0.1.9
|
||||
pycparser==2.13
|
||||
pycrypto==2.6.1
|
||||
pyforge==1.3.0
|
||||
PyHamcrest==1.9.0
|
||||
pyOpenSSL==16.2.0
|
||||
pyparsing==2.1.10
|
||||
pytest-xdist==1.15.0
|
||||
python-cinderclient==1.9.0
|
||||
python-dateutil==2.5.3
|
||||
python-glanceclient==2.5.0
|
||||
python-heatclient==1.5.0
|
||||
python-ironicclient==1.7.0
|
||||
python-keystoneclient==3.5.0
|
||||
python-muranoclient==0.11.0
|
||||
python-neutronclient==6.0.0
|
||||
python-novaclient==6.0.0
|
||||
python-openstackclient==3.3.0
|
||||
python-pom==1.0.2
|
||||
python-swiftclient==3.1.0
|
||||
pytz==2016.10
|
||||
PyYAML==3.12
|
||||
requests==2.11.1
|
||||
rfc3986==0.4.1
|
||||
scapy==2.3.3
|
||||
SecretStorage==2.3.1
|
||||
selenium==2.53.6
|
||||
sentinels==1.0.0
|
||||
six==1.10.0
|
||||
Sphinx==1.4.6
|
||||
stevedore==1.19.1
|
||||
subprocess32==3.2.7
|
||||
testresources==2.0.1
|
||||
tox==2.4.1
|
||||
unicodecsv==0.14.1
|
||||
wadllib==1.3.2
|
||||
waiting==1.3.0
|
||||
warlock==1.3.0
|
||||
wrapt==1.10.8
|
||||
wsgi-intercept==1.4.1
|
||||
xvfbwrapper==0.2.8
|
||||
zope.interface==4.3.2
|
|
@ -0,0 +1,11 @@
|
|||
from os.path import join, dirname
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="Vapor",
|
||||
version="0.1",
|
||||
description="Open Stack contrail plugin test suite.",
|
||||
packages=find_packages(),
|
||||
long_description=open(join(dirname(__file__), 'README.rst')).read(),
|
||||
install_requires=['pytest'],
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
# content of: tox.ini , put in same dir as setup.py
|
||||
[tox]
|
||||
envlist = py27
|
||||
|
||||
[testenv]
|
||||
deps=
|
||||
-e.
|
||||
-rrequirements.txt
|
||||
commands=py.test
|
||||
|
||||
[flake8]
|
||||
filename=*.py
|
||||
ignore = E731,H405,H304
|
||||
exclude = .venv,.git,.tox,dist,doc,*egg,build,releasenotes
|
||||
max-complexity=25
|
|
@ -0,0 +1,20 @@
|
|||
# pytest settings and fixtures
|
||||
|
||||
import pytest
|
||||
from stepler.conftest import *
|
||||
# from stepler.conftest import __all__
|
||||
|
||||
|
||||
# __all__ = sorted([
|
||||
# 'fixtures.client_contrail',
|
||||
# ])
|
||||
|
||||
# pytest_plugins = [
|
||||
# 'helpers.client_contrail'
|
||||
# ]
|
||||
|
||||
|
||||
# @pytest.fixture
|
||||
# def logger():
|
||||
# import logging
|
||||
# return logging
|
|
@ -0,0 +1,5 @@
|
|||
from .contrail import *
|
||||
|
||||
__all__ = sorted([
|
||||
'client_contrail'
|
||||
])
|
|
@ -0,0 +1,11 @@
|
|||
import pytest
|
||||
|
||||
from vapor.settings import CONTRAIL_CREDS
|
||||
from vapor.helpers.clients import ContrailClient
|
||||
|
||||
|
||||
@pytest.yield_fixture
|
||||
def client_contrail():
|
||||
with ContrailClient(CONTRAIL_CREDS['controller_addr']) as contrail:
|
||||
yield contrail
|
||||
print('helpers.clients.client_contrail')
|
|
@ -0,0 +1,2 @@
|
|||
from clients import *
|
||||
from clients import __all__
|
|
@ -0,0 +1,5 @@
|
|||
from .contrail_api import ContrailClient
|
||||
|
||||
__all__ = [
|
||||
'ContrailClient'
|
||||
]
|
|
@ -1,7 +1,10 @@
|
|||
import pytest
|
||||
|
||||
from keystoneauth1.identity.v2 import Password
|
||||
from keystoneauth1.session import Session
|
||||
|
||||
from conf import KEYSTONE_CREDS, PATH_TO_CERT, VERIFY_SSL, DISABLE_SSL
|
||||
from vapor.settings import (
|
||||
KEYSTONE_CREDS, PATH_TO_CERT, VERIFY_SSL, DISABLE_SSL)
|
||||
|
||||
|
||||
class ContrailClient(object):
|
||||
|
@ -10,7 +13,9 @@ class ContrailClient(object):
|
|||
def __init__(self, controller_node_ip, contrail_port=8082,
|
||||
credentials=KEYSTONE_CREDS, **kwargs):
|
||||
"""Create ContrailClient object."""
|
||||
print('[ContrailClient:__init__]')
|
||||
if DISABLE_SSL:
|
||||
|
||||
self.url = "http://{0}:{1}".format(controller_node_ip,
|
||||
contrail_port)
|
||||
self.keystone_url = "http://{0}:5000/v2.0".format(
|
||||
|
@ -28,6 +33,14 @@ class ContrailClient(object):
|
|||
tenant_name=KEYSTONE_CREDS['tenant_name'])
|
||||
self._client = Session(auth=auth, verify=False)
|
||||
|
||||
def __enter__(self):
|
||||
print('[ContrailClient:__enter__]')
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
print('[ContrailClient:__exit__]')
|
||||
pass
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
"""Client property."""
|
||||
|
@ -35,6 +48,7 @@ class ContrailClient(object):
|
|||
|
||||
def _get(self, data_path):
|
||||
"""Get method."""
|
||||
print('[_get] url: %s' % str(self.url + data_path))
|
||||
return self.client.get(url=self.url + data_path).json()
|
||||
|
||||
def _delete(self, data_path):
|
||||
|
@ -138,3 +152,4 @@ class ContrailClient(object):
|
|||
:return dictionary
|
||||
"""
|
||||
return self._get('/bgp-router/{0}'.format(bgp_id))
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Project, contrail and OpenStack settings
|
||||
|
||||
PATH_TO_CERT = '/tmp/cert.crt'
|
||||
VERIFY_SSL = False
|
||||
DISABLE_SSL = True
|
||||
KEYSTONE_CREDS = {
|
||||
'username': 'admin',
|
||||
'password': 'secret',
|
||||
'tenant_name': 'admin',
|
||||
}
|
||||
|
||||
CONTRAIL_CREDS = {
|
||||
'controller_addr': '192.168.1.127'
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import pytest
|
||||
|
||||
from vapor.helpers.clients.contrail_api import ContrailClient
|
||||
from vapor.settings import CONTRAIL_CREDS
|
||||
|
||||
from stepler.keystone.fixtures import keystone_client, get_keystone_client
|
||||
|
||||
@pytest.mark.parametrize("contrail_node_role", [
|
||||
'contrail-controller',
|
||||
'contrail-analytics',
|
||||
'contrail-analytics-db'
|
||||
])
|
||||
@pytest.mark.idempotent_id('1b1a0953-a772-4cfe-a7da-2f6de950123')
|
||||
def test_contrail_node_exist(keystone_client, contrail_node_role):
|
||||
services = []
|
||||
for service in keystone_client.services.list():
|
||||
services.append(service.name)
|
||||
print('Check contrail node %s status' % contrail_node_role)
|
||||
assert contrail_node_role in services
|
||||
|
||||
|
||||
def test_contrail_node_status(keytone_client):
|
|
@ -0,0 +1,72 @@
|
|||
# # from helpers.client_contrail import client_contrail
|
||||
#
|
||||
# import pytest
|
||||
#
|
||||
# # from stepler.conftest import *
|
||||
# # from stepler.conftest import __all__
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope='class', params=[1, 2, 3, 4])
|
||||
# def xxx(request):
|
||||
# """XXX fixture"""
|
||||
# print('$' * 80)
|
||||
# print('xxx: %s' % request)
|
||||
# print('$' * 80)
|
||||
#
|
||||
#
|
||||
# # @pytest.mark.smoke_test
|
||||
# # class Test_smoke(object):
|
||||
# #
|
||||
# # # def test_contrail_status(self, logger, client_contrail):
|
||||
# # # # client_contrail.get_networks()
|
||||
# # # logger.error(client_contrail)
|
||||
# # #
|
||||
# # #
|
||||
# # # def test_one(self, logger, xxx, request):
|
||||
# # # logger.debug('[test_one] 1111')
|
||||
# # # print('[test_one] done')
|
||||
# #
|
||||
# #
|
||||
# # def test_two(self, logger, xxx):
|
||||
# # logger.error('[test_two] 2222')
|
||||
# # print('[test_two] done')
|
||||
#
|
||||
#
|
||||
# # @pytest.mark.smoke_test
|
||||
# # def test_contrail(nova_client):
|
||||
# # print nova_client
|
||||
#
|
||||
#
|
||||
# from vapor.helpers.clients.contrail_api import ContrailClient
|
||||
# from vapor.settings import CONTRAIL_CREDS
|
||||
#
|
||||
#
|
||||
# @pytest.yield_fixture
|
||||
# def client_contrail():
|
||||
# print('[client_contrail]')
|
||||
# with ContrailClient(CONTRAIL_CREDS['controller_addr']) as contrail:
|
||||
# print('[client_contrail] yield')
|
||||
# yield contrail
|
||||
# print('[client_contrail] yield done')
|
||||
# print('helpers.clients.client_contrail')
|
||||
#
|
||||
#
|
||||
# @pytest.mark.idempotent_id('1b1a0953-a772-4cfe-a7da-2f6de950e456')
|
||||
# def test_contrail_1(client_contrail):
|
||||
# print('[test_contrail_1]->')
|
||||
# print client_contrail.get_route_tables()
|
||||
# print('[test_contrail_1]<-')
|
||||
#
|
||||
#
|
||||
# @pytest.mark.parametrize("contrail_node_role", [
|
||||
# 'contrail-controller',
|
||||
# 'contrail-analytics'
|
||||
# 'contrail-analytics-db'
|
||||
# ])
|
||||
# @pytest.mark.idempotent_id('1b1a0953-a772-4cfe-a7da-2f6de950123')
|
||||
# def test_contrail_node_status(client_contrail, contrail_node_role):
|
||||
# print('Check contrail node %s status' % contrail_node_role)
|
Loading…
Reference in New Issue