Add smoke test, wich check zookeeper znodes
Change-Id: I01b2e4592fba55693aea77c89eaa41e6fe3b4599
This commit is contained in:
parent
2dd9966ff2
commit
c1bf18c4dd
|
@ -4,3 +4,4 @@ git+https://github.com/gdyuldin/contrail-python-api@R3.0
|
|||
dpath
|
||||
jmespath==0.9.0
|
||||
contextlib2==0.5.4; python_version < '3.2'
|
||||
kazoo==2.2.1
|
||||
|
|
|
@ -18,6 +18,7 @@ from vapor.fixtures.policies import * # noqa
|
|||
from vapor.fixtures.security_groups import * # noqa
|
||||
from vapor.fixtures.skip import * # noqa
|
||||
from vapor.fixtures.subnets import * # noqa
|
||||
from vapor.fixtures.system_services import * # noqa
|
||||
|
||||
pytest_plugins = [
|
||||
'stepler.third_party.destructive_dispatcher',
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License
|
||||
|
||||
from kazoo.client import KazooClient
|
||||
from vapor import settings
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def znodes_list(nodes_ips):
|
||||
hosts_list = ""
|
||||
contrail_controllers_fqdns = settings.CONTRAIL_ROLES_DISTRIBUTION[
|
||||
settings.ROLE_CONTRAIL_CONTROLLER]
|
||||
for name in nodes_ips:
|
||||
if name in contrail_controllers_fqdns:
|
||||
hosts_list+="{}:{},".format(nodes_ips[name][0],
|
||||
settings.ZOOKEEPER_PORT)
|
||||
hosts_list = hosts_list[:-1]
|
||||
zk = KazooClient(hosts=hosts_list)
|
||||
zk.start()
|
||||
znodes_list_ = zk.get_children("/")
|
||||
zk.stop()
|
||||
zk.close()
|
||||
return znodes_list_
|
|
@ -99,7 +99,7 @@ CONTRAIL_ROLES_SERVICES_MAPPING = {
|
|||
CONTRAIL_ROLES_DISTRIBUTION_YAML = os.environ.get(
|
||||
'CONTRAIL_ROLES_DISTRIBUTION_YAML',
|
||||
os.path.join(
|
||||
BASE_DIR, '../roles_distribution_example.yaml'))
|
||||
BASE_DIR, '../roles_mk22_qa_lab01.yaml'))
|
||||
|
||||
with open(CONTRAIL_ROLES_DISTRIBUTION_YAML) as f:
|
||||
CONTRAIL_ROLES_DISTRIBUTION = yaml.safe_load(f) or {}
|
||||
|
@ -138,3 +138,23 @@ CONTRAIL_ANALYTIC_PROCESSES = {
|
|||
HEAT_TEMPLATES_PATH = os.path.join(BASE_DIR, 'heat')
|
||||
|
||||
VROUTER_HEADLESS_MODE_CMD = r"grep -iP '^headless_mode\s*=\s*true' /etc/contrail/contrail-vrouter-agent.conf" # noqa
|
||||
|
||||
ZOOKEEPER_PORT = 2181
|
||||
|
||||
ZOOKEEPER_NODES = ["api-server",
|
||||
"consumers",
|
||||
"svc-monitor",
|
||||
"contrail_cs",
|
||||
"device-manager",
|
||||
"controller_epoch",
|
||||
"lockpath",
|
||||
"id",
|
||||
"fq-name-to-uuid",
|
||||
"admin",
|
||||
"zookeeper",
|
||||
"api-server-election",
|
||||
"config",
|
||||
"controller",
|
||||
"schema-transformer",
|
||||
"brokers"]
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
from hamcrest import (assert_that, has_item, has_entry, is_not, empty,
|
||||
has_property, has_entries, has_items) # noqa H301
|
||||
has_property, has_entries,
|
||||
has_items,contains_inanyorder) # noqa H301
|
||||
import pycontrail.types as types
|
||||
import pytest
|
||||
from stepler.third_party import utils
|
||||
|
@ -153,3 +154,7 @@ def test_update_network_ipam(contrail_api_client, contrail_ipam):
|
|||
def test_contrail_alarms_is_empty(client_contrail_analytics):
|
||||
alarms = client_contrail_analytics.get_alarms()
|
||||
assert_that(alarms, empty())
|
||||
|
||||
def test_zookeeper_status(znodes_list):
|
||||
expected_znodes_list = settings.ZOOKEEPER_NODES
|
||||
assert_that(znodes_list, contains_inanyorder(*expected_znodes_list))
|
||||
|
|
Loading…
Reference in New Issue