Some MCP-related tests fixes

Change-Id: I75cf2865f6ac7f6aa01f90b8576e4305c7e9b831
This commit is contained in:
Georgy Dyuldin 2017-03-27 16:37:26 +03:00
parent bce05180a8
commit cad0646015
8 changed files with 31 additions and 27 deletions

View File

@ -38,6 +38,8 @@ Fill env file
OS_USERNAME=admin
OS_PASSWORD=admin
OS_TENANT_NAME=admin
CONTRAIL_API_URL=http://172.16.10.254:9082/
CONTRAIL_ANALYTICS_URL=http://172.16.10.254:9081/
OS_AUTH_URL=http://10.109.1.7:5000/v3
# os-faults config
@ -110,6 +112,8 @@ Fill env file
OS_USERNAME=admin
OS_PASSWORD=admin
OS_TENANT_NAME=admin
CONTRAIL_API_URL=http://172.16.10.254:9082/
CONTRAIL_ANALYTICS_URL=http://172.16.10.254:9081/
OS_AUTH_URL=http://10.109.1.7:5000/v3
# os-faults config

View File

@ -5,6 +5,10 @@ export OS_PASSWORD=secret
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://127.0.0.1:5000/v3
# contrail endpoints
export CONTRAIL_API_URL=http://172.16.10.254:9100/
export CONTRAIL_ANALYTICS_URL=http://172.16.10.254:9081/
# os-faults config
export OS_FAULTS_CLOUD_DRIVER=tcpcloud
export OS_FAULTS_CLOUD_DRIVER_ADDRESS=192.168.10.100

View File

@ -6,7 +6,7 @@ import logbook
import pycontrail.client as client
from six.moves import configparser
from six.moves.urllib import parse
from vapor import settings
from vapor.helpers import clients
@ -15,15 +15,16 @@ LOGGER = logbook.Logger(__name__)
@pytest.fixture
def client_contrail(session, contrail_api_endpoint):
with clients.ContrailClient(session, contrail_api_endpoint) as contrail:
def client_contrail(session):
with clients.ContrailClient(session,
settings.CONTRAIL_API_URL) as contrail:
yield contrail
@pytest.fixture
def client_contrail_analytics(session, contrail_analytics_endpoint):
def client_contrail_analytics(session):
return clients.ContrailAnalyticsClient(session,
contrail_analytics_endpoint)
settings.CONTRAIL_ANALYTICS_URL)
@pytest.fixture
@ -84,14 +85,6 @@ def contrail_api_endpoint(os_faults_steps):
return 'http://{}:{}/'.format(ip.strip(), port.strip())
@pytest.fixture(scope='module')
def contrail_analytics_endpoint(contrail_api_endpoint):
"""Return contrail analytics endpoint."""
parse_result = parse.urlparse(contrail_api_endpoint)
return parse_result._replace(netloc="{}:{}".format(
parse_result.hostname, settings.CONTRAIL_ANALYTICS_PORT)).geturl()
@pytest.fixture(scope='module')
def contrail_vrouter_agent_endpoint(contrail_services_http_introspect_ports):
"""Return contrail agent endpoint."""
@ -160,12 +153,12 @@ def contrail_services_http_introspect_ports(os_faults_steps, contrail_nodes):
@pytest.fixture
def contrail_api_client(session, contrail_api_endpoint):
def contrail_api_client(session):
"""Return instance of contail client."""
headers = {'Content-type': 'application/json; charset="UTF-8"'}
headers.update(session.get_auth_headers())
return client.Client(
url=contrail_api_endpoint, headers=headers, blocking=False)
url=settings.CONTRAIL_API_URL, headers=headers, blocking=False)
@pytest.fixture

View File

@ -3,8 +3,7 @@ import collections
import re
import attrdict
from hamcrest import (empty, has_entries, contains_inanyorder,
has_length) # noqa: H301
from hamcrest import (empty, has_entries, has_items, has_length) # noqa: H301
from stepler.third_party import waiter
from vapor.helpers import asserts
@ -118,7 +117,7 @@ def check_service_status(os_faults_steps,
return waiter.expect_that(
services,
has_entries(**{
node: contains_inanyorder(
node: has_items(
has_entries(service=service, status=expected_status))
for node in nodes_fqdns
}))

View File

@ -27,7 +27,9 @@ KEYSTONE_CREDS = {
CONTRAIL_CREDS = {'controller_addr': '192.168.1.127'}
CONTRAIL_ANALYTICS_PORT = 8081
CONTRAIL_API_URL = os.environ['CONTRAIL_API_URL']
CONTRAIL_ANALYTICS_URL = os.environ['CONTRAIL_ANALYTICS_URL']
NEUTRON_CONTRAIL_PLUGIN_CONFIG_PATH = (
'/etc/neutron/plugins/opencontrail/ContrailPlugin.ini')

View File

@ -191,7 +191,7 @@ def test_contrail_services_status_after_restart_master_node(os_faults_steps):
master_node_fqdn = None
for fqdn, services in services_statuses.items():
for service in services:
if (service['name'] == 'contrail-schema' and
if (service['service'] == 'contrail-schema' and
service['status'] == contrail_status.STATUS_ACTIVE):
master_node_fqdn = fqdn
break

View File

@ -238,8 +238,7 @@ def test_network_connectivity_with_policy(
server_steps.check_ping_between_servers_via_floating(resources.servers)
def test_change_login_and_password(session, current_project,
contrail_api_endpoint, create_user,
def test_change_login_and_password(session, current_project, create_user,
user_steps, role_steps):
"""Verify that login and password can be changed.
@ -267,7 +266,7 @@ def test_change_login_and_password(session, current_project,
'tenant_name': current_project.name
}
conn = client.Client(
url=contrail_api_endpoint, auth_params=auth_params, blocking=False)
url=settings.CONTRAIL_API_URL, auth_params=auth_params, blocking=False)
# Check client operate
assert_that(conn.virtual_networks_list(), is_not(empty()))
@ -279,7 +278,7 @@ def test_change_login_and_password(session, current_project,
# Make Contrail client with new user credentials
auth_params['password'] = password
conn = client.Client(
url=contrail_api_endpoint, auth_params=auth_params, blocking=False)
url=settings.CONTRAIL_API_URL, auth_params=auth_params, blocking=False)
# Check client operate
net_list = waiter.wait(

View File

@ -30,9 +30,12 @@ def test_router_table_cleanup(cirros_image, flavor, network, subnet,
hypervisor1, = sorted_hypervisors[:1]
server_create_args = dict(
image=cirros_image, flavor=flavor, networks=[network])
computes = os_faults_steps.get_nodes(fqdns=[
hypervisor1.hypervisor_hostname, hypervisor2.hypervisor_hostname
])
fqdns = [
os_faults_steps.get_fqdn_by_host_name(name)
for name in (hypervisor1.hypervisor_hostname,
hypervisor2.hypervisor_hostname)
]
computes = os_faults_steps.get_nodes(fqdns=fqdns)
route_table_before = vrouter_steps.get_route_table(os_faults_steps,
computes)