summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasledzinskiy <asledzinskiy@mirantis.com>2016-12-28 16:56:26 +0200
committerasledzinskiy <asledzinskiy@mirantis.com>2016-12-28 16:56:26 +0200
commita102043b11d012b4906b41e0536b108b007092dd (patch)
tree99dcdd574681dddc084b794c1781a06855e135c2
parent5d3db0e0d45566c7a7af6839a334f63247dd1e63 (diff)
Add test with ccp in container
- Add test where ccp is installed as container and OS is deployed with containerized ccp Change-Id: Ic6d1884b8330b3ef1e3a214391a5c442306b4fd6
Notes
Notes (review): Verified+1: Mirantis CCP CI <mirantis-fuel-ccp-ci@mirantis.com> Code-Review+2: Artem Panchenko <apanchenko@mirantis.com> Workflow+1: Dennis Dmitriev <ddmitriev@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 28 Dec 2016 16:15:02 +0000 Reviewed-on: https://review.openstack.org/415477 Project: openstack/fuel-ccp-tests Branch: refs/heads/master
-rw-r--r--fuel_ccp_tests/managers/ccpmanager.py27
-rw-r--r--fuel_ccp_tests/tests/system/test_ccp_containerized.py88
2 files changed, 111 insertions, 4 deletions
diff --git a/fuel_ccp_tests/managers/ccpmanager.py b/fuel_ccp_tests/managers/ccpmanager.py
index 02fcabd..c7698b8 100644
--- a/fuel_ccp_tests/managers/ccpmanager.py
+++ b/fuel_ccp_tests/managers/ccpmanager.py
@@ -34,17 +34,20 @@ class CCPManager(object):
34 self.__underlay = underlay 34 self.__underlay = underlay
35 super(CCPManager, self).__init__() 35 super(CCPManager, self).__init__()
36 36
37 def install_ccp(self, use_defaults=True): 37 def fetch_ccp(self):
38 """Base action to deploy k8s by external deployment script"""
39 LOG.info("Trying to install fuel-ccp on admin node")
40 with self.__underlay.remote( 38 with self.__underlay.remote(
41 host=self.__config.k8s.kube_host) as remote: 39 host=self.__config.k8s.kube_host) as remote:
42
43 ccp_repo_url = settings.CCP_REPO 40 ccp_repo_url = settings.CCP_REPO
44 LOG.info("Fetch ccp from github") 41 LOG.info("Fetch ccp from github")
45 cmd = 'git clone {}'.format(ccp_repo_url) 42 cmd = 'git clone {}'.format(ccp_repo_url)
46 remote.check_call(cmd, verbose=True) 43 remote.check_call(cmd, verbose=True)
47 44
45 def install_ccp(self, use_defaults=True):
46 """Base action to deploy k8s by external deployment script"""
47 LOG.info("Trying to install fuel-ccp on admin node")
48 self.fetch_ccp()
49 with self.__underlay.remote(
50 host=self.__config.k8s.kube_host) as remote:
48 LOG.info('Install fuel-ccp from local path') 51 LOG.info('Install fuel-ccp from local path')
49 cmd = 'pip install --upgrade fuel-ccp/' 52 cmd = 'pip install --upgrade fuel-ccp/'
50 with remote.get_sudo(remote): 53 with remote.get_sudo(remote):
@@ -53,6 +56,22 @@ class CCPManager(object):
53 LOG.debug("*** Result STDOUT:\n{0}".format(result.stdout_str)) 56 LOG.debug("*** Result STDOUT:\n{0}".format(result.stdout_str))
54 LOG.debug("*** Result STDERR:\n{0}".format(result.stderr_str)) 57 LOG.debug("*** Result STDERR:\n{0}".format(result.stderr_str))
55 58
59 def dockerize_ccp(self):
60 self.__underlay.sudo_check_call("cd fuel-ccp/docker/"
61 "ccp&&./dockerize.sh",
62 host=self.__config.k8s.kube_host)
63 ccp_script = '''
64 docker run --rm -i --name=fuel-ccp --network=host \
65 -v ~/:/home/`whoami`/ -v /var/run/docker.sock:/var/run/docker.sock \
66 -e LOCAL_USER_ID=`id -u $USER` -e LOCAL_USER_NAME=`whoami` \
67 fuel-ccp:latest $@
68 '''
69 self.__underlay.sudo_check_call("echo -e '{}' > /usr/local/"
70 "bin/ccp".format(ccp_script),
71 host=self.__config.k8s.kube_host)
72 self.__underlay.sudo_check_call("chmod +x /usr/local/bin/ccp",
73 host=self.__config.k8s.kube_host)
74
56 @property 75 @property
57 def default_params(self): 76 def default_params(self):
58 if hasattr(self, '_default_params'): 77 if hasattr(self, '_default_params'):
diff --git a/fuel_ccp_tests/tests/system/test_ccp_containerized.py b/fuel_ccp_tests/tests/system/test_ccp_containerized.py
new file mode 100644
index 0000000..7202bb0
--- /dev/null
+++ b/fuel_ccp_tests/tests/system/test_ccp_containerized.py
@@ -0,0 +1,88 @@
1# Copyright 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import pytest
16
17import base_test
18from fuel_ccp_tests import logger
19from fuel_ccp_tests import settings
20from fuel_ccp_tests.helpers import post_os_deploy_checks
21
22LOG = logger.logger
23
24
25class TestCcpContainerized(base_test.SystemBaseTest):
26 """Deploy OpenStack with CCP in container
27
28 pytest.mark: ccp_containerized
29 """
30
31 @pytest.mark.ccp_containerized
32 @pytest.mark.fail_snapshot
33 def test_fuel_ccp_containerized(
34 self, underlay, config, k8scluster, ccp_actions, show_step):
35 """Deploy environment using ccp in container
36
37 Scenario:
38 1. Revert snapshot
39 2. Install ccp in container
40 3. Deploy environment
41 4. Check deployment
42
43 Duration 35 min
44 """
45
46 ccp_actions.default_params = settings.CCP_CLI_PARAMS
47 show_step(2)
48 ccp_actions.fetch_ccp()
49 ccp_actions.dockerize_ccp()
50
51 ccp_actions.put_yaml_config(
52 path=settings.CCP_DEPLOY_CONFIG,
53 config=settings.CCP_DEFAULT_GLOBALS)
54 ccp_actions.put_yaml_config(
55 path=settings.CCP_SOURCES_CONFIG,
56 config=settings.CCP_BUILD_SOURCES)
57 ccp_actions.put_yaml_config(
58 path=settings.CCP_FETCH_CONFIG,
59 config=settings.CCP_FETCH_PARAMS)
60
61 with open(config.ccp_deploy.topology_path, 'r') as f:
62 ccp_actions.put_raw_config(
63 path=settings.CCP_DEPLOY_TOPOLOGY,
64 content=f.read())
65
66 ccp_actions.init_default_config(include_files=[
67 settings.CCP_DEPLOY_CONFIG,
68 settings.CCP_SOURCES_CONFIG,
69 settings.CCP_DEPLOY_TOPOLOGY,
70 settings.CCP_FETCH_CONFIG])
71 config.ccp.os_host = config.k8s.kube_host
72
73 if settings.REGISTRY == "127.0.0.1:31500":
74 k8scluster.create_registry()
75 ccp_actions.build()
76 show_step(3)
77 ccp_actions.deploy()
78 post_os_deploy_checks.check_jobs_status(k8scluster.api)
79 post_os_deploy_checks.check_pods_status(k8scluster.api)
80 show_step(4)
81 remote = underlay.remote(host=config.k8s.kube_host)
82 underlay.sudo_check_call("pip install python-openstackclient",
83 host=config.k8s.kube_host)
84 remote.check_call(
85 "source openrc-{0}; bash fuel-ccp/tools/deploy-test-vms.sh -a"
86 " create".format(
87 settings.CCP_CONF["kubernetes"]["namespace"]),
88 timeout=600)