summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/features/Dockerfile5
-rw-r--r--docker/features/testcases.yaml16
-rw-r--r--functest/ci/testcases.yaml2
-rw-r--r--functest/opnfv_tests/openstack/refstack_client/refstack_client.py6
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py6
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py6
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py42
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py15
-rw-r--r--functest/utils/functest_utils.py19
-rw-r--r--functest/utils/openstack_utils.py15
10 files changed, 73 insertions, 59 deletions
diff --git a/docker/features/Dockerfile b/docker/features/Dockerfile
index 6cd88b2bc..54bffe827 100644
--- a/docker/features/Dockerfile
+++ b/docker/features/Dockerfile
@@ -4,13 +4,16 @@ ARG BRANCH=master
ARG OPENSTACK_TAG=stable/ocata
COPY thirdparty-requirements.txt thirdparty-requirements.txt
-RUN apk --no-cache add --virtual .build-deps --update \
+RUN apk --no-cache add --update nodejs nodejs-npm && \
+ apk --no-cache add --virtual .build-deps --update \
python-dev build-base linux-headers libffi-dev \
openssl-dev libjpeg-turbo-dev git && \
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 && \
+ npm -g install npm@latest && \
+ (cd /src/promise/source && npm install) && \
git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino /src/domino && \
rm -r thirdparty-requirements.txt /src/domino/.git && \
apk del .build-deps
diff --git a/docker/features/testcases.yaml b/docker/features/testcases.yaml
index 3587b59c8..052bd47f3 100644
--- a/docker/features/testcases.yaml
+++ b/docker/features/testcases.yaml
@@ -8,6 +8,22 @@ tiers:
integrated in functest
testcases:
-
+ case_name: promise
+ project_name: promise
+ criteria: 100
+ blocking: false
+ description: >-
+ Test suite from Promise project.
+ dependencies:
+ installer: '(fuel)|(joid)'
+ scenario: ''
+ run:
+ module: 'functest.core.feature'
+ class: 'BashFeature'
+ args:
+ cmd: 'run_promise_tests.py'
+
+ -
case_name: bgpvpn
project_name: sdnvpn
criteria: 100
diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml
index d53202d5c..869144811 100644
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -149,7 +149,7 @@ tiers:
case_name: odl
project_name: functest
criteria: 100
- blocking: true
+ blocking: false
description: >-
Test Suite for the OpenDaylight SDN Controller. It
integrates some test suites from upstream using
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 921d69b4d..86053ccf3 100644
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -107,13 +107,13 @@ class RefstackClient(testcase.OSGCTestCase):
num_failures = match[1]
LOGGER.info("".join(match))
success_testcases = []
- for match in re.findall(r"\{0\}(.*?)[. ]*ok", output):
+ for match in re.findall(r"\{0\} (.*?)[. ]*ok", output):
success_testcases.append(match)
failed_testcases = []
- for match in re.findall(r"\{0\}(.*?)[. ]*FAILED", output):
+ for match in re.findall(r"\{0\} (.*?)[. ]*FAILED", output):
failed_testcases.append(match)
skipped_testcases = []
- for match in re.findall(r"\{0\}(.*?)[. ]*SKIPPED:", output):
+ for match in re.findall(r"\{0\} (.*?)[. ]*SKIPPED:", output):
skipped_testcases.append(match)
num_executed = int(num_tests) - int(num_skipped)
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 4993c74a9..b00bc6af6 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -196,13 +196,13 @@ class TempestCommon(testcase.OSGCTestCase):
output = logfile.read()
success_testcases = []
- for match in re.findall('(.*?)[. ]*success ', output):
+ for match in re.findall('.*\{0\} (.*?)[. ]*success ', output):
success_testcases.append(match)
failed_testcases = []
- for match in re.findall('(.*?)[. ]*fail ', output):
+ for match in re.findall('.*\{0\} (.*?)[. ]*fail ', output):
failed_testcases.append(match)
skipped_testcases = []
- for match in re.findall('(.*?)[. ]*skip:', output):
+ for match in re.findall('.*\{0\} (.*?)[. ]*skip:', output):
skipped_testcases.append(match)
self.details = {"tests": int(num_tests),
diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
index e4e3364d6..c5601075e 100644
--- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
@@ -79,9 +79,9 @@ class OSRefstackClientTesting(unittest.TestCase):
''')
self.details = {"tests": 3,
"failures": 1,
- "success": [' tempest.api.compute [18.464988s]'],
- "errors": [' tempest.api.volume [0.230334s]'],
- "skipped": [' tempest.api.network [1.265828s]']}
+ "success": ['tempest.api.compute [18.464988s]'],
+ "errors": ['tempest.api.volume [0.230334s]'],
+ "skipped": ['tempest.api.network [1.265828s]']}
with mock.patch('__builtin__.open',
mock.mock_open(read_data=log_file)):
self.refstackclient.parse_refstack_result()
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index 98c7d6e9c..b4cc5b73b 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -133,24 +133,20 @@ class FunctestUtilsTesting(unittest.TestCase):
self.assertEqual(functest_utils.get_scenario(),
self.scenario)
- @mock.patch('functest.utils.functest_utils.get_build_tag')
- def test_get_version_daily_job(self, mock_get_build_tag):
- mock_get_build_tag.return_value = self.build_tag
+ def test_get_version_daily_job(self):
+ CONST.__setattr__('BUILD_TAG', self.build_tag)
self.assertEqual(functest_utils.get_version(), self.version)
- @mock.patch('functest.utils.functest_utils.get_build_tag')
- def test_get_version_weekly_job(self, mock_get_build_tag):
- mock_get_build_tag.return_value = self.build_tag_week
+ def test_get_version_weekly_job(self):
+ CONST.__setattr__('BUILD_TAG', self.build_tag_week)
self.assertEqual(functest_utils.get_version(), self.version)
- @mock.patch('functest.utils.functest_utils.get_build_tag')
- def test_get_version_with_dummy_build_tag(self, mock_get_build_tag):
- mock_get_build_tag.return_value = 'whatever'
+ def test_get_version_with_dummy_build_tag(self):
+ CONST.__setattr__('BUILD_TAG', 'whatever')
self.assertEqual(functest_utils.get_version(), 'unknown')
- @mock.patch('functest.utils.functest_utils.get_build_tag')
- def test_get_version_unknown(self, mock_get_build_tag):
- mock_get_build_tag.return_value = "unknown_build_tag"
+ def test_get_version_unknown(self):
+ CONST.__setattr__('BUILD_TAG', 'unknown_build_tag')
self.assertEqual(functest_utils.get_version(), "unknown")
@mock.patch('functest.utils.functest_utils.logger.info')
@@ -173,33 +169,15 @@ class FunctestUtilsTesting(unittest.TestCase):
self.node_name)
@mock.patch('functest.utils.functest_utils.logger.info')
- def test_get_build_tag_failed(self, mock_logger_info):
- with mock.patch.dict(os.environ,
- {},
- clear=True):
- self.assertEqual(functest_utils.get_build_tag(),
- "none")
- mock_logger_info.assert_called_once_with("Impossible to retrieve"
- " the build tag")
-
- def test_get_build_tag_default(self):
- with mock.patch.dict(os.environ,
- {'BUILD_TAG': self.build_tag},
- clear=True):
- self.assertEqual(functest_utils.get_build_tag(),
- self.build_tag)
-
- @mock.patch('functest.utils.functest_utils.logger.info')
def test_logger_test_results(self, mock_logger_info):
CONST.__setattr__('results_test_db_url', self.db_url)
+ CONST.__setattr__('BUILD_TAG', self.build_tag)
with mock.patch('functest.utils.functest_utils.get_pod_name',
return_value=self.node_name), \
mock.patch('functest.utils.functest_utils.get_scenario',
return_value=self.scenario), \
mock.patch('functest.utils.functest_utils.get_version',
- return_value=self.version), \
- mock.patch('functest.utils.functest_utils.get_build_tag',
- return_value=self.build_tag):
+ return_value=self.version):
functest_utils.logger_test_results(self.project, self.case_name,
self.status, self.details)
mock_logger_info.assert_called_once_with(
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index cabd18e50..3bd7e3dd6 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -13,6 +13,7 @@ import unittest
import mock
from functest.utils import openstack_utils
+from functest.utils.constants import CONST
class OSUtilsTesting(unittest.TestCase):
@@ -187,11 +188,18 @@ class OSUtilsTesting(unittest.TestCase):
mock_obj.configure_mock(**attrs)
self.role = mock_obj
+ mock_obj = mock.Mock()
+ attrs = {'id': 'domain_id',
+ 'name': 'test_domain'}
+ mock_obj.configure_mock(**attrs)
+ self.domain = mock_obj
+
self.keystone_client = mock.Mock()
attrs = {'projects.list.return_value': [self.tenant],
'tenants.list.return_value': [self.tenant],
'users.list.return_value': [self.user],
'roles.list.return_value': [self.role],
+ 'domains.list.return_value': [self.domain],
'projects.create.return_value': self.tenant,
'tenants.create.return_value': self.tenant,
'users.create.return_value': self.user,
@@ -1650,9 +1658,16 @@ class OSUtilsTesting(unittest.TestCase):
'test_role'),
'role_id')
+ def test_get_domain_id_default(self):
+ self.assertEqual(openstack_utils.
+ get_domain_id(self.keystone_client,
+ 'test_domain'),
+ 'domain_id')
+
def test_create_tenant_default(self):
with mock.patch('functest.utils.openstack_utils.'
'is_keystone_v3', return_value=True):
+ CONST.__setattr__('OS_PROJECT_DOMAIN_NAME', 'Default')
self.assertEqual(openstack_utils.
create_tenant(self.keystone_client,
'test_tenant',
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 91781bd27..bf68e43a3 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -107,7 +107,9 @@ def get_version():
# jenkins-functest-fuel-baremetal-weekly-master-8
# use regex to match branch info
rule = "(dai|week)ly-(.+?)-[0-9]*"
- build_tag = get_build_tag()
+ build_tag = CONST.__getattribute__('BUILD_TAG')
+ if not build_tag:
+ build_tag = 'none'
m = re.search(rule, build_tag)
if m:
return m.group(2)
@@ -128,19 +130,6 @@ def get_pod_name():
return "unknown-pod"
-def get_build_tag():
- """
- Get build tag of jenkins jobs
- """
- try:
- build_tag = os.environ['BUILD_TAG']
- except KeyError:
- logger.info("Impossible to retrieve the build tag")
- build_tag = "none"
-
- return build_tag
-
-
def logger_test_results(project, case_name, status, details):
"""
Format test case results for the logger
@@ -148,7 +137,7 @@ def logger_test_results(project, case_name, status, details):
pod_name = get_pod_name()
scenario = get_scenario()
version = get_version()
- build_tag = get_build_tag()
+ build_tag = CONST.__getattribute__('BUILD_TAG')
db_url = CONST.__getattribute__("results_test_db_url")
logger.info(
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 1bdfa2536..335f14cd1 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -22,6 +22,7 @@ from heatclient import client as heatclient
from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
+from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -1376,13 +1377,25 @@ def get_role_id(keystone_client, role_name):
return id
+def get_domain_id(keystone_client, domain_name):
+ domains = keystone_client.domains.list()
+ id = ''
+ for d in domains:
+ if d.name == domain_name:
+ id = d.id
+ break
+ return id
+
+
def create_tenant(keystone_client, tenant_name, tenant_description):
try:
if is_keystone_v3():
+ domain_name = CONST.__getattribute__('OS_PROJECT_DOMAIN_NAME')
+ domain_id = get_domain_id(keystone_client, domain_name)
tenant = keystone_client.projects.create(
name=tenant_name,
description=tenant_description,
- domain="default",
+ domain=domain_id,
enabled=True)
else:
tenant = keystone_client.tenants.create(tenant_name,