Browse Source

Some MCP-related tests fixes

Change-Id: I75cf2865f6ac7f6aa01f90b8576e4305c7e9b831
Georgy Dyuldin 2 years ago
parent
commit
cad0646015

+ 4
- 0
plugin_test/vapor/README.rst View File

@@ -38,6 +38,8 @@ Fill env file
38 38
     OS_USERNAME=admin
39 39
     OS_PASSWORD=admin
40 40
     OS_TENANT_NAME=admin
41
+    CONTRAIL_API_URL=http://172.16.10.254:9082/
42
+    CONTRAIL_ANALYTICS_URL=http://172.16.10.254:9081/
41 43
     OS_AUTH_URL=http://10.109.1.7:5000/v3
42 44
 
43 45
     # os-faults config
@@ -110,6 +112,8 @@ Fill env file
110 112
     OS_USERNAME=admin
111 113
     OS_PASSWORD=admin
112 114
     OS_TENANT_NAME=admin
115
+    CONTRAIL_API_URL=http://172.16.10.254:9082/
116
+    CONTRAIL_ANALYTICS_URL=http://172.16.10.254:9081/
113 117
     OS_AUTH_URL=http://10.109.1.7:5000/v3
114 118
 
115 119
     # os-faults config

+ 4
- 0
plugin_test/vapor/exports.sh View File

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

+ 8
- 15
plugin_test/vapor/vapor/fixtures/contrail.py View File

@@ -6,7 +6,7 @@ import logbook
6 6
 
7 7
 import pycontrail.client as client
8 8
 from six.moves import configparser
9
-from six.moves.urllib import parse
9
+
10 10
 
11 11
 from vapor import settings
12 12
 from vapor.helpers import clients
@@ -15,15 +15,16 @@ LOGGER = logbook.Logger(__name__)
15 15
 
16 16
 
17 17
 @pytest.fixture
18
-def client_contrail(session, contrail_api_endpoint):
19
-    with clients.ContrailClient(session, contrail_api_endpoint) as contrail:
18
+def client_contrail(session):
19
+    with clients.ContrailClient(session,
20
+                                settings.CONTRAIL_API_URL) as contrail:
20 21
         yield contrail
21 22
 
22 23
 
23 24
 @pytest.fixture
24
-def client_contrail_analytics(session, contrail_analytics_endpoint):
25
+def client_contrail_analytics(session):
25 26
     return clients.ContrailAnalyticsClient(session,
26
-                                           contrail_analytics_endpoint)
27
+                                           settings.CONTRAIL_ANALYTICS_URL)
27 28
 
28 29
 
29 30
 @pytest.fixture
@@ -84,14 +85,6 @@ def contrail_api_endpoint(os_faults_steps):
84 85
     return 'http://{}:{}/'.format(ip.strip(), port.strip())
85 86
 
86 87
 
87
-@pytest.fixture(scope='module')
88
-def contrail_analytics_endpoint(contrail_api_endpoint):
89
-    """Return contrail analytics endpoint."""
90
-    parse_result = parse.urlparse(contrail_api_endpoint)
91
-    return parse_result._replace(netloc="{}:{}".format(
92
-        parse_result.hostname, settings.CONTRAIL_ANALYTICS_PORT)).geturl()
93
-
94
-
95 88
 @pytest.fixture(scope='module')
96 89
 def contrail_vrouter_agent_endpoint(contrail_services_http_introspect_ports):
97 90
     """Return contrail agent endpoint."""
@@ -160,12 +153,12 @@ def contrail_services_http_introspect_ports(os_faults_steps, contrail_nodes):
160 153
 
161 154
 
162 155
 @pytest.fixture
163
-def contrail_api_client(session, contrail_api_endpoint):
156
+def contrail_api_client(session):
164 157
     """Return instance of contail client."""
165 158
     headers = {'Content-type': 'application/json; charset="UTF-8"'}
166 159
     headers.update(session.get_auth_headers())
167 160
     return client.Client(
168
-        url=contrail_api_endpoint, headers=headers, blocking=False)
161
+        url=settings.CONTRAIL_API_URL, headers=headers, blocking=False)
169 162
 
170 163
 
171 164
 @pytest.fixture

+ 2
- 3
plugin_test/vapor/vapor/helpers/contrail_status.py View File

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

+ 3
- 1
plugin_test/vapor/vapor/settings.py View File

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

+ 1
- 1
plugin_test/vapor/vapor/tests/test_smoke.py View File

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

+ 3
- 4
plugin_test/vapor/vapor/tests/test_system.py View File

@@ -238,8 +238,7 @@ def test_network_connectivity_with_policy(
238 238
     server_steps.check_ping_between_servers_via_floating(resources.servers)
239 239
 
240 240
 
241
-def test_change_login_and_password(session, current_project,
242
-                                   contrail_api_endpoint, create_user,
241
+def test_change_login_and_password(session, current_project, create_user,
243 242
                                    user_steps, role_steps):
244 243
     """Verify that login and password can be changed.
245 244
 
@@ -267,7 +266,7 @@ def test_change_login_and_password(session, current_project,
267 266
         'tenant_name': current_project.name
268 267
     }
269 268
     conn = client.Client(
270
-        url=contrail_api_endpoint, auth_params=auth_params, blocking=False)
269
+        url=settings.CONTRAIL_API_URL, auth_params=auth_params, blocking=False)
271 270
 
272 271
     # Check client operate
273 272
     assert_that(conn.virtual_networks_list(), is_not(empty()))
@@ -279,7 +278,7 @@ def test_change_login_and_password(session, current_project,
279 278
     # Make Contrail client with new user credentials
280 279
     auth_params['password'] = password
281 280
     conn = client.Client(
282
-        url=contrail_api_endpoint, auth_params=auth_params, blocking=False)
281
+        url=settings.CONTRAIL_API_URL, auth_params=auth_params, blocking=False)
283 282
 
284 283
     # Check client operate
285 284
     net_list = waiter.wait(

+ 6
- 3
plugin_test/vapor/vapor/tests/test_vrouter.py View File

@@ -30,9 +30,12 @@ def test_router_table_cleanup(cirros_image, flavor, network, subnet,
30 30
     hypervisor1, = sorted_hypervisors[:1]
31 31
     server_create_args = dict(
32 32
         image=cirros_image, flavor=flavor, networks=[network])
33
-    computes = os_faults_steps.get_nodes(fqdns=[
34
-        hypervisor1.hypervisor_hostname, hypervisor2.hypervisor_hostname
35
-    ])
33
+    fqdns = [
34
+        os_faults_steps.get_fqdn_by_host_name(name)
35
+        for name in (hypervisor1.hypervisor_hostname,
36
+                     hypervisor2.hypervisor_hostname)
37
+    ]
38
+    computes = os_faults_steps.get_nodes(fqdns=fqdns)
36 39
 
37 40
     route_table_before = vrouter_steps.get_route_table(os_faults_steps,
38 41
                                                        computes)

Loading…
Cancel
Save