From e9334da17298cfeff4ccfb079bb3e3908e85c0e2 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Tue, 14 Feb 2017 13:37:35 +0100 Subject: Integrate BAROMETER feature test case Also, add a executor method in VNFBase to allow re-write it for some cases where the feature is another python script instead of shell script. Change-Id: Id734553dffe32fdc9a0befc3f4c0e29e5d56fc61 Signed-off-by: jose.lausuch --- docker/Dockerfile | 4 ++++ functest/ci/config_functest.yaml | 1 + functest/ci/testcases.yaml | 15 +++++++++++++++ functest/core/feature_base.py | 10 +++++++++- functest/opnfv_tests/features/barometer.py | 28 ++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 functest/opnfv_tests/features/barometer.py diff --git a/docker/Dockerfile b/docker/Dockerfile index 13f43dd4..0aefeee3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -84,6 +84,7 @@ RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/doctor ${REPO RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/ovno ${REPOS_DIR}/ovno RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/promise ${REPOS_DIR}/promise RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/netready ${REPOS_DIR}/netready +RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/barometer ${REPOS_DIR}/barometer RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sfc ${REPOS_DIR}/sfc RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/securityscanning ${REPOS_DIR}/securityscanning RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${REPOS_DIR}/releng @@ -109,6 +110,9 @@ RUN cd ${FUNCTEST_REPO_DIR} \ RUN cd ${RELENG_MODULE_DIR} \ && pip install . +RUN cd ${REPOS_DIR}/barometer \ + && pip install . + RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \ -not -path "*tests/unit*" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ && find ${FUNCTEST_REPO_DIR} -name "*.sh" |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 8fa4bd34..3bad1b8f 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -21,6 +21,7 @@ general: dir_repo_onos: /home/opnfv/repos/onos repo_promise: /home/opnfv/repos/promise repo_netready: /home/opnfv/repos/netready + repo_barometer: /home/opnfv/repos/barometer repo_doctor: /home/opnfv/repos/doctor repo_copper: /home/opnfv/repos/copper dir_repo_ovno: /home/opnfv/repos/ovno diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 77bd0152..b93b01ee 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -348,6 +348,21 @@ tiers: run: module: 'functest.opnfv_tests.features.netready' class: 'GluonVping' + - + name: barometer + criteria: 'status == "PASS"' + blocking: false + description: >- + Test suite for the Barometer project. Separate tests verify the + proper configuration and functionality of the following + collectd plugins Ceilometer, Hugepages, Memory RAS (mcelog), + and OVS Events + dependencies: + installer: 'fuel' + scenario: 'kvm_ovs_dpdk_bar' + run: + module: 'functest.opnfv_tests.features.barometer' + class: 'BarometerCollectd' - name: components order: 3 diff --git a/functest/core/feature_base.py b/functest/core/feature_base.py index fe9a9998..2bd1ec83 100644 --- a/functest/core/feature_base.py +++ b/functest/core/feature_base.py @@ -7,6 +7,7 @@ from functest.utils.constants import CONST class FeatureBase(base.TestcaseBase): + def __init__(self, project='functest', case='', repo='', cmd=''): super(FeatureBase, self).__init__() self.project_name = project @@ -19,7 +20,7 @@ class FeatureBase(base.TestcaseBase): def run(self, **kwargs): self.prepare() self.start_time = time.time() - ret = ft_utils.execute_command(self.cmd, output_file=self.result_file) + ret = self.execute() self.stop_time = time.time() self.post() self.parse_results(ret) @@ -27,6 +28,13 @@ class FeatureBase(base.TestcaseBase): self.logger.info("Test result is stored in '%s'" % self.result_file) return base.TestcaseBase.EX_OK + def execute(self): + ''' + Executer method that can be overwritten + By default it executes a shell command. + ''' + return ft_utils.execute_command(self.cmd, output_file=self.result_file) + def prepare(self, **kwargs): pass diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py new file mode 100644 index 00000000..aec2bce5 --- /dev/null +++ b/functest/opnfv_tests/features/barometer.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +# +# 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 + + +import functest.core.feature_base as base +import functest.utils.functest_logger as ft_logger + +from baro_tests import collectd + + +class BarometerCollectd(base.FeatureBase): + ''' + Class for executing barometercollectd testcase. + ''' + + def __init__(self): + super(BarometerCollectd, self).__init__(project='barometer', + case='barometercollectd', + repo='dir_repo_barometer') + self.logger = ft_logger.Logger("BarometerCollectd").getLogger() + + def execute(self): + return collectd.main(self.logger) -- cgit 1.2.3-korg