diff options
-rw-r--r-- | docker/Dockerfile | 7 | ||||
-rw-r--r-- | docker/features/Dockerfile | 6 | ||||
-rw-r--r-- | docker/features/testcases.yaml | 5 | ||||
-rw-r--r-- | docker/features/thirdparty-requirements.txt | 1 | ||||
-rw-r--r-- | docker/parser/hooks/post_checkout | 6 | ||||
-rw-r--r-- | docker/restapi/Dockerfile | 6 | ||||
-rw-r--r-- | docker/restapi/thirdparty-requirements.txt | 1 | ||||
-rw-r--r-- | docker/thirdparty-requirements.txt | 2 | ||||
-rw-r--r-- | docker/vnf/testcases.yaml | 2 | ||||
-rw-r--r-- | functest/ci/config_functest.yaml | 2 | ||||
-rw-r--r-- | functest/ci/testcases.yaml | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 44 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml | 2 | ||||
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 46 | ||||
-rw-r--r-- | upper-constraints.txt | 2 |
15 files changed, 111 insertions, 26 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 5d934dfe9..2e59adad6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,6 +52,8 @@ python-dev \ python-mock \ python-pip \ python3 \ +python3-dev \ +python3-pip \ postgresql \ ruby \ ruby-dev \ @@ -62,6 +64,7 @@ wget \ --no-install-recommends RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0 +RUN python3 -m pip install --upgrade pip setuptools==30.0.0 RUN mkdir -p ${REPOS_VNFS_DIR} \ && mkdir -p ${FUNCTEST_BASE_DIR}/results \ @@ -92,6 +95,10 @@ RUN wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/uppe -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \ -rthirdparty-requirements.txt && \ + python3 -m pip install --src /src \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + doctor-tests && \ mkdir -p /etc/rally && \ printf "[database]\nconnection = 'sqlite:////var/lib/rally/database/rally.sqlite'" > /etc/rally/rally.conf && \ mkdir -p /var/lib/rally/database && rally-manage db create && \ diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile index f20c58619..1ff2dc42f 100644 --- a/docker/features/Dockerfile +++ b/docker/features/Dockerfile @@ -6,12 +6,16 @@ ARG OPENSTACK_TAG=stable/ocata COPY thirdparty-requirements.txt thirdparty-requirements.txt RUN apk --no-cache add --update nodejs nodejs-npm python3 sshpass && \ apk --no-cache add --virtual .build-deps --update \ - python-dev build-base linux-headers libffi-dev \ + python-dev python3-dev build-base linux-headers libffi-dev \ openssl-dev libjpeg-turbo-dev && \ pip install --no-cache-dir --src /src \ -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ -rthirdparty-requirements.txt && \ + python3 -m pip install --no-cache-dir --src /src \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + doctor-tests && \ npm -g install npm@latest && \ (cd /src/promise/source && npm install) && \ rm -r thirdparty-requirements.txt && \ diff --git a/docker/features/testcases.yaml b/docker/features/testcases.yaml index e8a2095c5..dc137429b 100644 --- a/docker/features/testcases.yaml +++ b/docker/features/testcases.yaml @@ -25,20 +25,19 @@ tiers: - case_name: doctor-notification - enabled: false project_name: doctor criteria: 100 blocking: false description: >- Test suite from Doctor project. dependencies: - installer: '(apex)|(fuel)' + installer: 'apex' scenario: '^((?!fdio).)*$' run: module: 'functest.core.feature' class: 'BashFeature' args: - cmd: '(cd /src/doctor-test/tests && run.sh)' + cmd: 'doctor-test' - case_name: bgpvpn diff --git a/docker/features/thirdparty-requirements.txt b/docker/features/thirdparty-requirements.txt index 0a9f2a101..618f750be 100644 --- a/docker/features/thirdparty-requirements.txt +++ b/docker/features/thirdparty-requirements.txt @@ -2,4 +2,5 @@ baro_tests sdnvpn sfc promise +doctor-tests;python_version>='3.0' domino diff --git a/docker/parser/hooks/post_checkout b/docker/parser/hooks/post_checkout deleted file mode 100644 index 8f5e4337a..000000000 --- a/docker/parser/hooks/post_checkout +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -from="${DOCKER_REPO%/*}/functest-core:euphrates" -sed -i "s|^FROM.*$|FROM ${from}|" Dockerfile - -exit $? diff --git a/docker/restapi/Dockerfile b/docker/restapi/Dockerfile index 23adcc852..50eb8a890 100644 --- a/docker/restapi/Dockerfile +++ b/docker/restapi/Dockerfile @@ -12,7 +12,7 @@ RUN apk --no-cache add --update nodejs nodejs-npm python3 sshpass \ ruby ruby-bundler ruby-irb ruby-rdoc dnsmasq \ procps libxslt libxml2 zlib libffi && \ apk --no-cache add --virtual .build-deps --update \ - python-dev build-base linux-headers libffi-dev \ + python-dev python3-dev build-base linux-headers libffi-dev \ openssl-dev libjpeg-turbo-dev \ ruby-dev g++ make libxslt-dev libxml2-dev zlib-dev libffi-dev && \ git clone --depth 1 https://github.com/openstack/refstack-client.git /src/refstack-client && \ @@ -22,6 +22,10 @@ RUN apk --no-cache add --update nodejs nodejs-npm python3 sshpass \ -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ -e/src/refstack-client -rthirdparty-requirements.txt && \ + python3 -m pip install --no-cache-dir --src /src \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG \ + -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ + doctor-tests && \ git clone --depth 1 https://git.opendaylight.org/gerrit/p/integration/test.git /src/odl_test && \ (cd src/odl_test && git checkout -b $ODL_TAG) && \ git clone --depth 1 -b $FDS_TAG https://gerrit.opnfv.org/gerrit/fds /src/fds && \ diff --git a/docker/restapi/thirdparty-requirements.txt b/docker/restapi/thirdparty-requirements.txt index 0a9f2a101..618f750be 100644 --- a/docker/restapi/thirdparty-requirements.txt +++ b/docker/restapi/thirdparty-requirements.txt @@ -2,4 +2,5 @@ baro_tests sdnvpn sfc promise +doctor-tests;python_version>='3.0' domino diff --git a/docker/thirdparty-requirements.txt b/docker/thirdparty-requirements.txt index 741eb8ef6..a63545777 100644 --- a/docker/thirdparty-requirements.txt +++ b/docker/thirdparty-requirements.txt @@ -2,7 +2,7 @@ baro_tests sdnvpn sfc promise -doctor-test +doctor-tests;python_version>='3.0' tosca-parser>=0.7.0 # Apache-2.0 heat-translator>=0.4.0 # Apache-2.0 refstack-client diff --git a/docker/vnf/testcases.yaml b/docker/vnf/testcases.yaml index c0eba8225..64c0024ef 100644 --- a/docker/vnf/testcases.yaml +++ b/docker/vnf/testcases.yaml @@ -56,7 +56,7 @@ tiers: description: >- This test case is vRouter testing. dependencies: - installer: 'fuel' + installer: '' scenario: 'nosdn-nofeature' run: module: 'functest.opnfv_tests.vnf.router.cloudify_vrouter' diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 16ba8b822..575b44783 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -136,6 +136,8 @@ rally: subnet_name: rally-subnet subnet_cidr: 192.168.140.0/24 router_name: rally-router + flavor_name: rally-tiny + flavor_alt_name: rally-mini vnf: juju_epc: diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 67ecaf8eb..470cdb0f7 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -253,20 +253,19 @@ tiers: - case_name: doctor-notification - enabled: false project_name: doctor criteria: 100 blocking: false description: >- Test suite from Doctor project. dependencies: - installer: '(apex)|(fuel)' + installer: 'apex' scenario: '^((?!fdio).)*$' run: module: 'functest.core.feature' class: 'BashFeature' args: - cmd: '(cd /src/doctor-test/tests && run.sh)' + cmd: 'doctor-test' - case_name: bgpvpn diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 5aba38820..e92639b29 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -29,6 +29,7 @@ from functest.energy import energy from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils.constants import CONST +from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor from snaps.openstack.create_image import ImageSettings from snaps.openstack.create_network import NetworkSettings, SubnetSettings from snaps.openstack.create_router import RouterSettings @@ -54,7 +55,11 @@ class RallyBase(testcase.TestCase): if hasattr(CONST, 'openstack_extra_properties'): GLANCE_IMAGE_EXTRA_PROPERTIES = CONST.__getattribute__( 'openstack_extra_properties') - FLAVOR_NAME = "m1.tiny" + FLAVOR_NAME = CONST.__getattribute__('rally_flavor_name') + FLAVOR_ALT_NAME = CONST.__getattribute__('rally_flavor_alt_name') + FLAVOR_EXTRA_SPECS = None + if hasattr(CONST, 'flavor_extra_specs'): + FLAVOR_EXTRA_SPECS = CONST.__getattribute__('flavor_extra_specs') RALLY_DIR = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/rally') @@ -102,8 +107,11 @@ class RallyBase(testcase.TestCase): self.mode = '' self.summary = [] self.scenario_dir = '' + self.image_name = None self.ext_net_name = None self.priv_net_id = None + self.flavor_name = None + self.flavor_alt_name = None self.smoke = None self.test_name = None self.start_time = None @@ -112,8 +120,9 @@ class RallyBase(testcase.TestCase): def _build_task_args(self, test_file_name): task_args = {'service_list': [test_file_name]} - task_args['image_name'] = self.GLANCE_IMAGE_NAME - task_args['flavor_name'] = self.FLAVOR_NAME + task_args['image_name'] = self.image_name + task_args['flavor_name'] = self.flavor_name + task_args['flavor_alt_name'] = self.flavor_alt_name task_args['glance_image_location'] = self.GLANCE_IMAGE_PATH task_args['glance_image_format'] = self.GLANCE_IMAGE_FORMAT task_args['tmpl_dir'] = self.TEMPLATE_DIR @@ -467,24 +476,25 @@ class RallyBase(testcase.TestCase): if self.test_name not in self.TESTS: raise Exception("Test name '%s' is invalid" % self.test_name) - image_name = self.GLANCE_IMAGE_NAME + self.guid network_name = self.RALLY_PRIVATE_NET_NAME + self.guid subnet_name = self.RALLY_PRIVATE_SUBNET_NAME + self.guid router_name = self.RALLY_ROUTER_NAME + self.guid + self.image_name = self.GLANCE_IMAGE_NAME + self.guid + self.flavor_name = self.FLAVOR_NAME + self.guid + self.flavor_alt_name = self.FLAVOR_ALT_NAME + self.guid self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) - LOGGER.debug('Getting or creating image...') + LOGGER.debug("Creating image '%s'...", self.image_name) image_creator = deploy_utils.create_image( self.os_creds, ImageSettings( - name=image_name, + name=self.image_name, image_file=self.GLANCE_IMAGE_PATH, img_format=self.GLANCE_IMAGE_FORMAT, image_user=self.GLANCE_IMAGE_USERNAME, public=True, extra_properties=self.GLANCE_IMAGE_EXTRA_PROPERTIES)) if image_creator is None: - raise Exception("Failed to get or create image '%s'" % - image_name) + raise Exception("Failed to create image") self.creators.append(image_creator) LOGGER.debug("Creating network '%s'...", network_name) @@ -511,6 +521,24 @@ class RallyBase(testcase.TestCase): raise Exception("Failed to create router") self.creators.append(router_creator) + LOGGER.debug("Creating flavor '%s'...", self.flavor_name) + flavor_creator = OpenStackFlavor( + self.os_creds, FlavorSettings( + name=self.flavor_name, ram=512, disk=1, vcpus=1, + metadata=self.FLAVOR_EXTRA_SPECS)) + if flavor_creator is None or flavor_creator.create() is None: + raise Exception("Failed to create flavor") + self.creators.append(flavor_creator) + + LOGGER.debug("Creating flavor '%s'...", self.flavor_alt_name) + flavor_alt_creator = OpenStackFlavor( + self.os_creds, FlavorSettings( + name=self.flavor_alt_name, ram=1024, disk=1, vcpus=1, + metadata=self.FLAVOR_EXTRA_SPECS)) + if flavor_alt_creator is None or flavor_alt_creator.create() is None: + raise Exception("Failed to create flavor") + self.creators.append(flavor_alt_creator) + def _run_tests(self): if self.test_name == 'all': for test in self.TESTS: diff --git a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml index d7622093d..8fb5f5eef 100644 --- a/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml +++ b/functest/opnfv_tests/openstack/rally/scenario/full/opnfv-nova.yaml @@ -215,7 +215,7 @@ args: {{ vm_params(image_name, flavor_name) }} to_flavor: - name: "m1.small" + name: {{ flavor_alt_name }} confirm: true force_delete: false nics: diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index 63c0192ba..191722dc0 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -328,6 +328,52 @@ class OSRallyTesting(unittest.TestCase): mock_get_net.assert_called() mock_create_router.assert_called() + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_ext_net_name', return_value='test_net_name') + @mock.patch('snaps.openstack.utils.deploy_utils.create_image', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.utils.deploy_utils.create_network', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.utils.deploy_utils.create_router', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.create_flavor.OpenStackFlavor.create', + return_value=None) + def test_prepare_env_flavor_creation_failed( + self, mock_create_flavor, mock_create_router, mock_create_net, + mock_get_img, mock_get_net): + self.rally_base.TESTS = ['test1', 'test2'] + self.rally_base.test_name = 'test1' + with self.assertRaises(Exception): + self.rally_base._prepare_env() + mock_create_net.assert_called() + mock_get_img.assert_called() + mock_get_net.assert_called() + mock_create_router.assert_called() + mock_create_flavor.assert_called_once() + + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_ext_net_name', return_value='test_net_name') + @mock.patch('snaps.openstack.utils.deploy_utils.create_image', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.utils.deploy_utils.create_network', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.utils.deploy_utils.create_router', + return_value=mock.Mock()) + @mock.patch('snaps.openstack.create_flavor.OpenStackFlavor.create', + side_effect=[mock.Mock, None]) + def test_prepare_env_flavor_alt_creation_failed( + self, mock_create_flavor, mock_create_router, mock_create_net, + mock_get_img, mock_get_net): + self.rally_base.TESTS = ['test1', 'test2'] + self.rally_base.test_name = 'test1' + with self.assertRaises(Exception): + self.rally_base._prepare_env() + mock_create_net.assert_called() + mock_get_img.assert_called() + mock_get_net.assert_called() + mock_create_router.assert_called() + self.assertEqual(mock_create_flavor.call_count, 2) + @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_run_task', return_value=mock.Mock()) def test_run_tests_all(self, mock_run_task): diff --git a/upper-constraints.txt b/upper-constraints.txt index 049424e0d..a38296b16 100644 --- a/upper-constraints.txt +++ b/upper-constraints.txt @@ -4,7 +4,7 @@ git+https://gerrit.opnfv.org/gerrit/barometer@stable/euphrates#egg=baro_tests git+https://gerrit.opnfv.org/gerrit/sdnvpn@stable/euphrates#egg=sdnvpn git+https://gerrit.opnfv.org/gerrit/sfc@stable/euphrates#egg=sfc -e git+https://gerrit.opnfv.org/gerrit/promise@stable/euphrates#egg=promise --e git+https://gerrit.opnfv.org/gerrit/doctor@stable/euphrates#egg=doctor-test +-e git+https://gerrit.opnfv.org/gerrit/doctor@stable/euphrates#egg=doctor-tests git+https://gerrit.opnfv.org/gerrit/domino@stable/euphrates#egg=domino cloudify-rest-client===4.0 iniparse===0.4 |