Add test with ccp in container
- Add test where ccp is installed as container and OS is deployed with containerized ccp Change-Id: Ic6d1884b8330b3ef1e3a214391a5c442306b4fd6
This commit is contained in:
parent
5d3db0e0d4
commit
a102043b11
|
@ -34,17 +34,20 @@ class CCPManager(object):
|
|||
self.__underlay = underlay
|
||||
super(CCPManager, self).__init__()
|
||||
|
||||
def install_ccp(self, use_defaults=True):
|
||||
"""Base action to deploy k8s by external deployment script"""
|
||||
LOG.info("Trying to install fuel-ccp on admin node")
|
||||
def fetch_ccp(self):
|
||||
with self.__underlay.remote(
|
||||
host=self.__config.k8s.kube_host) as remote:
|
||||
|
||||
ccp_repo_url = settings.CCP_REPO
|
||||
LOG.info("Fetch ccp from github")
|
||||
cmd = 'git clone {}'.format(ccp_repo_url)
|
||||
remote.check_call(cmd, verbose=True)
|
||||
|
||||
def install_ccp(self, use_defaults=True):
|
||||
"""Base action to deploy k8s by external deployment script"""
|
||||
LOG.info("Trying to install fuel-ccp on admin node")
|
||||
self.fetch_ccp()
|
||||
with self.__underlay.remote(
|
||||
host=self.__config.k8s.kube_host) as remote:
|
||||
LOG.info('Install fuel-ccp from local path')
|
||||
cmd = 'pip install --upgrade fuel-ccp/'
|
||||
with remote.get_sudo(remote):
|
||||
|
@ -53,6 +56,22 @@ class CCPManager(object):
|
|||
LOG.debug("*** Result STDOUT:\n{0}".format(result.stdout_str))
|
||||
LOG.debug("*** Result STDERR:\n{0}".format(result.stderr_str))
|
||||
|
||||
def dockerize_ccp(self):
|
||||
self.__underlay.sudo_check_call("cd fuel-ccp/docker/"
|
||||
"ccp&&./dockerize.sh",
|
||||
host=self.__config.k8s.kube_host)
|
||||
ccp_script = '''
|
||||
docker run --rm -i --name=fuel-ccp --network=host \
|
||||
-v ~/:/home/`whoami`/ -v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-e LOCAL_USER_ID=`id -u $USER` -e LOCAL_USER_NAME=`whoami` \
|
||||
fuel-ccp:latest $@
|
||||
'''
|
||||
self.__underlay.sudo_check_call("echo -e '{}' > /usr/local/"
|
||||
"bin/ccp".format(ccp_script),
|
||||
host=self.__config.k8s.kube_host)
|
||||
self.__underlay.sudo_check_call("chmod +x /usr/local/bin/ccp",
|
||||
host=self.__config.k8s.kube_host)
|
||||
|
||||
@property
|
||||
def default_params(self):
|
||||
if hasattr(self, '_default_params'):
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
# 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
|
||||
|
||||
import base_test
|
||||
from fuel_ccp_tests import logger
|
||||
from fuel_ccp_tests import settings
|
||||
from fuel_ccp_tests.helpers import post_os_deploy_checks
|
||||
|
||||
LOG = logger.logger
|
||||
|
||||
|
||||
class TestCcpContainerized(base_test.SystemBaseTest):
|
||||
"""Deploy OpenStack with CCP in container
|
||||
|
||||
pytest.mark: ccp_containerized
|
||||
"""
|
||||
|
||||
@pytest.mark.ccp_containerized
|
||||
@pytest.mark.fail_snapshot
|
||||
def test_fuel_ccp_containerized(
|
||||
self, underlay, config, k8scluster, ccp_actions, show_step):
|
||||
"""Deploy environment using ccp in container
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot
|
||||
2. Install ccp in container
|
||||
3. Deploy environment
|
||||
4. Check deployment
|
||||
|
||||
Duration 35 min
|
||||
"""
|
||||
|
||||
ccp_actions.default_params = settings.CCP_CLI_PARAMS
|
||||
show_step(2)
|
||||
ccp_actions.fetch_ccp()
|
||||
ccp_actions.dockerize_ccp()
|
||||
|
||||
ccp_actions.put_yaml_config(
|
||||
path=settings.CCP_DEPLOY_CONFIG,
|
||||
config=settings.CCP_DEFAULT_GLOBALS)
|
||||
ccp_actions.put_yaml_config(
|
||||
path=settings.CCP_SOURCES_CONFIG,
|
||||
config=settings.CCP_BUILD_SOURCES)
|
||||
ccp_actions.put_yaml_config(
|
||||
path=settings.CCP_FETCH_CONFIG,
|
||||
config=settings.CCP_FETCH_PARAMS)
|
||||
|
||||
with open(config.ccp_deploy.topology_path, 'r') as f:
|
||||
ccp_actions.put_raw_config(
|
||||
path=settings.CCP_DEPLOY_TOPOLOGY,
|
||||
content=f.read())
|
||||
|
||||
ccp_actions.init_default_config(include_files=[
|
||||
settings.CCP_DEPLOY_CONFIG,
|
||||
settings.CCP_SOURCES_CONFIG,
|
||||
settings.CCP_DEPLOY_TOPOLOGY,
|
||||
settings.CCP_FETCH_CONFIG])
|
||||
config.ccp.os_host = config.k8s.kube_host
|
||||
|
||||
if settings.REGISTRY == "127.0.0.1:31500":
|
||||
k8scluster.create_registry()
|
||||
ccp_actions.build()
|
||||
show_step(3)
|
||||
ccp_actions.deploy()
|
||||
post_os_deploy_checks.check_jobs_status(k8scluster.api)
|
||||
post_os_deploy_checks.check_pods_status(k8scluster.api)
|
||||
show_step(4)
|
||||
remote = underlay.remote(host=config.k8s.kube_host)
|
||||
underlay.sudo_check_call("pip install python-openstackclient",
|
||||
host=config.k8s.kube_host)
|
||||
remote.check_call(
|
||||
"source openrc-{0}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
|
||||
" create".format(
|
||||
settings.CCP_CONF["kubernetes"]["namespace"]),
|
||||
timeout=600)
|
Loading…
Reference in New Issue