Merge "Add test for nova service"

This commit is contained in:
Jenkins 2016-09-08 12:47:00 +00:00 committed by Gerrit Code Review
commit f403538acc
5 changed files with 79 additions and 65 deletions

View File

@ -18,7 +18,7 @@ LOG = logger.logger
# TODO: replace check with deployment status request
def check_pods_status(k8sclient, timeout=600, namespace='ccp'):
def check_pods_status(k8sclient, timeout=1500, namespace='ccp'):
LOG.info("Check pods status")
def is_pod_running(cluster, pod_name, namespace=namespace):
@ -42,7 +42,7 @@ def check_pods_status(k8sclient, timeout=600, namespace='ccp'):
# TODO: replace check with deployment status request
def check_jobs_status(k8sclient, timeout=600, namespace='ccp'):
def check_jobs_status(k8sclient, timeout=1500, namespace='ccp'):
LOG.info("Check jobs status")
def is_job_successful(cluster, job_name, namespace=namespace):

View File

@ -141,7 +141,7 @@ class K8SManager(object):
registry_pod = self.api.pods.create(body=registry, namespace='default')
self.api.services.create(body=service, namespace='default')
registry.wait_running()
registry_pod.wait_running()
def get_pod_phase(self, pod_name, namespace):
return self.api.pods.get(

View File

@ -106,7 +106,7 @@ CCP_CLI_PARAMS = {
"builder-workers": "1",
"builder-push": "",
"registry-address": REGISTRY or "127.0.0.1:31500",
"kubernetes-namespace": "demo",
"kubernetes-namespace": "ccp",
"repositories-skip-empty": "",
"deploy-config": "/tmp/ccp-globals.yaml",
"images-namespace": IMAGES_NAMESPACE,

View File

@ -0,0 +1,61 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
import pytest
from fuel_ccp_tests.helpers import post_os_deploy_checks
from fuel_ccp_tests.helpers import ext
class TestPreCommitNova(object):
"""docstring for TestPreCommitNova
Scenario:
1. Install k8s
2. Install fuel-ccp
3. Fetch all repositories
4. Fetch nova from review
5. Fetch containers from external registry
6. Build nova container
7. Deploy Openstack
8. Run tempest
"""
@pytest.mark.test_nova_on_commit
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
def test_deploy_os_with_custom_nova(
self, ccpcluster, k8s_actions, rally):
"""
Scenario:
1. Install k8s
2. Install fuel-ccp
3. Fetch repos
4. Upload repo with changes
5. Build components
6. Deploy components
7. Run compute tempest suite
"""
k8s_actions.create_registry()
ccpcluster.fetch()
ccpcluster.update_service('nova')
ccpcluster.build(suppress_output=False)
ccpcluster.deploy()
rally.prepare()
rally.pull_image()
rally.run()
post_os_deploy_checks.check_jobs_status(k8s_actions.api)
post_os_deploy_checks.check_pods_status(k8s_actions.api)
rally.run_tempest('--regex tempest.api.compute')

View File

@ -11,65 +11,26 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import pytest
import base_test
from fuel_ccp_tests import logger
from fuel_ccp_tests import settings
from fuel_ccp_tests.helpers import post_install_k8s_checks
from fuel_ccp_tests.helpers import post_os_deploy_checks
from fuel_ccp_tests.helpers import ext
LOG = logger.logger
@pytest.mark.deploy_openstack
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
class TestDeployOpenstack(base_test.SystemBaseTest):
"""Deploy OpenStack with CCP
pytest.mark: deploy_openstack
"""
snapshot_microservices_deployed = 'snapshot_microservices_deployed'
def get_params(self, params_list, exclude_list=None):
params = []
for item in params_list:
if isinstance(item, dict):
if item.keys()[0] not in exclude_list:
params.append(item)
else:
if item not in exclude_list:
params.append(item)
params_dict = {}
for item in filter(
lambda x: isinstance(x, dict), params):
params_dict.update(item)
params_list = [item for item in params if not isinstance(
item, dict)]
return params_list, params_dict
def pre_build_deploy_step(self, remote):
topology_path = os.path.join(
os.getcwd(),
'fuel_ccp_tests/templates/k8s_templates/k8s_topology.yaml')
remote.upload(topology_path, './')
command = '>/var/log/microservices.log'
with remote.get_sudo(remote):
LOG.info(
"Running command '{cmd}' on node {node}".format(
cmd=command,
node=remote.hostname
)
)
result = remote.check_call(command, verbose=True)
assert result['exit_code'] == 0
@pytest.mark.snapshot_needed(name=snapshot_microservices_deployed)
@pytest.mark.fail_snapshot
def test_fuel_ccp_deploy_microservices(self, config, underlay, ccpcluster,
k8scluster):
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
@pytest.mark.deploy_openstack
def test_fuel_ccp_deploy_microservices(self, ccpcluster, k8s_actions):
"""Deploy base environment
Scenario:
@ -80,27 +41,22 @@ class TestDeployOpenstack(base_test.SystemBaseTest):
Duration 35 min
"""
k8sclient = k8scluster.api
remote = underlay.remote(host=config.k8s.kube_host)
if settings.BUILD_IMAGES:
k8scluster.create_registry()
k8s_actions.create_registry()
ccpcluster.build()
post_install_k8s_checks.check_calico_network(remote, k8sclient)
else:
if not settings.REGISTRY:
raise ValueError("The REGISTRY variable should be set with "
"external registry address, "
"current value {0}".format(settings.REGISTRY))
ccpcluster.deploy()
post_os_deploy_checks.check_jobs_status(k8sclient, timeout=1500,
namespace='ccp')
post_os_deploy_checks.check_pods_status(k8sclient, timeout=2500,
namespace='ccp')
post_os_deploy_checks.check_jobs_status(k8s_actions.api)
post_os_deploy_checks.check_pods_status(k8s_actions.api)
@pytest.mark.snapshot_needed
@pytest.mark.revert_snapshot(ext.SNAPSHOT.k8s_deployed)
@pytest.mark.fail_snapshot
def test_fuel_ccp_dry_run(self, config, underlay, ccpcluster, k8scluster):
@pytest.mark.revert_snapshot(ext.SNAPSHOT.ccp_deployed)
@pytest.mark.component
@pytest.mark.dry_run
def test_fuel_ccp_dry_run(self, ccpcluster, k8s_actions):
"""Deploy base environment
Scenario:
@ -112,13 +68,10 @@ class TestDeployOpenstack(base_test.SystemBaseTest):
Duration 35 min
"""
k8sclient = k8scluster.api
k8scluster.create_registry()
k8s_actions.create_registry()
ccpcluster.build()
export_dir = "/home/{user}/export".format(user=settings.SSH_LOGIN)
ccpcluster.dry_deploy(export_dir=export_dir)
k8scluster.create_objects(folder=export_dir)
post_os_deploy_checks.check_jobs_status(k8sclient, timeout=1500,
namespace='default')
post_os_deploy_checks.check_pods_status(k8sclient, timeout=2500,
namespace='default')
k8s_actions.create_objects(folder=export_dir)
post_os_deploy_checks.check_jobs_status(k8s_actions.api)
post_os_deploy_checks.check_pods_status(k8s_actions.api)