diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-06-09 10:53:41 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-06-09 11:25:02 +0200 |
commit | 0c55898253147b8fb6e5ef1afbf6f462a5b343b5 (patch) | |
tree | 0d05dc7dcacec517403412273068482d4eed7f3d | |
parent | f7b6a9a8d69313bbb8203eaf25b2d78d86ae799c (diff) |
Stop using a forked obsolete repo
It leverages on the official clearwater live test instead.
It now parses the output directly.
Change-Id: Ia7746c13362323daf72b3536d294401f0b7ae42f
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | docker/vnf/Dockerfile | 13 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/clearwater_ims_base.py | 27 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 32 |
3 files changed, 29 insertions, 43 deletions
diff --git a/docker/vnf/Dockerfile b/docker/vnf/Dockerfile index 54241875e..ac8bd1019 100644 --- a/docker/vnf/Dockerfile +++ b/docker/vnf/Dockerfile @@ -2,7 +2,8 @@ FROM opnfv/functest-core ARG BRANCH=master ARG OPENSTACK_TAG=stable/queens -ARG VIMS_TEST_TAG=stable +ARG VIMS_TEST_TAG=release-129 +ARG QUAFF_TAG=a6d9a184f03af5d8831ca4631c98dee0de60441c ARG VIMS_TAG=fraser ARG VROUTER_TAG=fraser ARG JUJU_TAG=tags/juju-2.2.5 @@ -15,11 +16,14 @@ RUN apk --no-cache add --update \ ruby ruby-bundler ruby-irb ruby-rdoc dnsmasq \ procps libxslt libxml2 zlib libffi python3 go musl-dev && \ apk --no-cache add --virtual .build-deps --update \ - ruby-dev g++ make libxslt-dev libxml2-dev zlib-dev libffi-dev && \ + ruby-dev g++ make libxslt-dev libxml2-dev zlib-dev libffi-dev g++ make && \ wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG | \ sed -E s/^tempest==+\(.*\)$/-e\ git+https:\\/\\/github.com\\/openstack\\/tempest@\\1#egg=tempest/ | \ > upper-constraints.txt && \ - git clone --depth 1 -b $VIMS_TEST_TAG https://github.com/boucherv-orange/clearwater-live-test.git /src/vims-test && \ + git clone --depth 1 -b $VIMS_TEST_TAG https://github.com/Metaswitch/clearwater-live-test /src/vims-test && \ + git clone https://github.com/rkd91/quaff /src/vims-test/quaff && \ + (cd /src/vims-test/quaff && git checkout $QUAFF_TAG) && \ + git clone --depth 1 -b $VIMS_TEST_TAG https://github.com/Metaswitch/clearwater-build-infra /src/vims-test/build-infra && \ git clone --depth 1 -b $VIMS_TAG https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater.git /src/vims && \ git clone --depth 1 -b $VROUTER_TAG https://github.com/oolorg/opnfv-vnf-vyos-blueprint.git /src/opnfv-vnf-vyos-blueprint && \ git clone https://github.com/RebacaInc/abot_charm.git /src/epc-requirements/abot_charm && \ @@ -32,7 +36,8 @@ RUN apk --no-cache add --update \ go install -v github.com/juju/juju/... && \ rm -rf $GOPATH/go/src/ $GOPATH/pkg && \ (cd /src/vims-test && bundle config build.nokogiri --use-system-libraries && bundle install --system) && \ - rm -r upper-constraints.txt /src/vims-test/.git /src/vims/.git /src/opnfv-vnf-vyos-blueprint/.git \ + rm -r upper-constraints.txt /src/vims-test/.git /src/vims/.git /src/vims-test/quaff/.git \ + /src/vims-test/build-infra/.git /src/opnfv-vnf-vyos-blueprint/.git \ /src/epc-requirements/abot_charm/.git && \ apk del .build-deps COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py index 94915c839..ae01cfa3e 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py +++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py @@ -6,9 +6,9 @@ # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 -import json import logging import os +import re import shlex import shutil import subprocess @@ -151,19 +151,18 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): if result != "": self.logger.debug(result) - vims_test_result = "" - tempFile = os.path.join(self.test_dir, "temp.json") + vims_test_result = {} try: - self.logger.debug("Trying to load test results") - with open(tempFile) as f: - vims_test_result = json.load(f) - f.close() + grp = re.search( + '(\d+) failures out of (\d+) tests run\n.*?' + '(\d+) tests skipped', result) + assert grp + vims_test_result["failures"] = int(grp.group(1)) + vims_test_result["total"] = int(grp.group(2)) + vims_test_result["skipped"] = int(grp.group(3)) + vims_test_result['passed'] = ( + int(grp.group(2)) - int(grp.group(3)) - int(grp.group(1))) except Exception: # pylint: disable=broad-except - self.logger.error("Unable to retrieve test results") - - try: - os.remove(tempFile) - except Exception: # pylint: disable=broad-except - self.logger.error("Deleting file failed") - + self.logger.exception("Cannot parse live tests results") + return None return vims_test_result diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 659549408..711cd8237 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -387,24 +387,26 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): if not dns_ip: return False - vims_test_result = self.run_clearwater_live_test( + short_result = self.run_clearwater_live_test( dns_ip=dns_ip, public_domain=self.vnf['inputs']["public_domain"]) duration = time.time() - start_time - short_result, nb_test = sig_test_format(vims_test_result) self.__logger.info(short_result) self.details['test_vnf'].update(result=short_result, - full_result=vims_test_result, duration=duration) try: - vnf_test_rate = short_result['passed'] / nb_test + vnf_test_rate = short_result['passed'] / ( + short_result['total'] - short_result['skipped']) # orchestrator + vnf + test_vnf self.result += vnf_test_rate / 3 * 100 except ZeroDivisionError: self.__logger.error("No test has been executed") self.details['test_vnf'].update(status='FAIL') return False - + except Exception: # pylint: disable=broad-except + self.__logger.exception("Cannot calculate results") + self.details['test_vnf'].update(status='FAIL') + return False return True if vnf_test_rate > 0 else False def clean(self): @@ -540,23 +542,3 @@ def _get_deployment_environment_creation_execution(client, deployment_id): raise RuntimeError('Failed to get create_deployment_environment ' 'workflow execution.' 'Available executions: {0}'.format(executions)) - - -def sig_test_format(sig_test): - """Process the signaling result to have a short result.""" - nb_passed = 0 - nb_failures = 0 - nb_skipped = 0 - for data_test in sig_test: - if data_test['result'] == "Passed": - nb_passed += 1 - elif data_test['result'] == "Failed": - nb_failures += 1 - elif data_test['result'] == "Skipped": - nb_skipped += 1 - short_sig_test_result = {} - short_sig_test_result['passed'] = nb_passed - short_sig_test_result['failures'] = nb_failures - short_sig_test_result['skipped'] = nb_skipped - nb_test = nb_passed + nb_skipped - return (short_sig_test_result, nb_test) |