From dcbfbcd2c8392fba4b4b15bc97076dd8cc2cfa1f Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Tue, 13 Oct 2015 06:57:21 +0200 Subject: [PATCH] Separate exclusion list for source and binary types Separate list of excluded images for source and binary unit tests. Change-Id: I4b6032db25c898272491c44c7a06f7cddf7a2298 Closes-Bug: #1487252 --- tests/test_build.py | 59 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/tests/test_build.py b/tests/test_build.py index bfc334f969..8fd673a6c7 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -10,24 +10,27 @@ # License for the specific language governing permissions and limitations # under the License. +import abc import os +import sys from mock import patch -from os import path from oslo_log import fixture as log_fixture from oslo_log import log as logging from oslotest import base import six import testtools -import sys -sys.path.append(path.abspath(path.join(path.dirname(__file__), '../tools'))) +sys.path.append( + os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools'))) from kolla.cmd import build LOG = logging.getLogger(__name__) -class BuildTest(base.BaseTestCase): +@six.add_metaclass(abc.ABCMeta) +class BuildTest(object): + excluded_images = abc.abstractproperty() def setUp(self): super(BuildTest, self).setUp() @@ -42,16 +45,9 @@ class BuildTest(base.BaseTestCase): LOG.info("Running with args %s", self.build_args) bad_results, good_results, unmatched_results = build.main() - # these are images that are known to not build properly - excluded_images = ["gnocchi-base", - "murano-base", - "ironic-pxe", - "ironic-discoverd", - "mistral-base"] - failures = 0 for image, result in six.iteritems(bad_results): - if image in excluded_images: + if image in self.excluded_images: if result is 'error': continue failures = failures + 1 @@ -70,46 +66,55 @@ class BuildTest(base.BaseTestCase): self.assertEqual(failures, 0, "%d failure(s) occurred" % failures) -class BuildTestCentosBinary(BuildTest): +class BuildTestCentosBinary(BuildTest, base.BaseTestCase): + excluded_images = ["gnocchi-base", + "murano-base", + "ironic-pxe", + "ironic-discoverd", + "mistral-base", + "murano-base"] + def setUp(self): super(BuildTestCentosBinary, self).setUp() self.build_args.extend(["--base", "centos", "--type", "binary"]) -class BuildTestCentosSource(BuildTest): +class BuildTestCentosSource(BuildTest, base.BaseTestCase): + excluded_images = ["gnocchi-base", + "murano-base", + "ironic-pxe", + "ironic-discoverd", + "mistral-base"] + def setUp(self): super(BuildTestCentosSource, self).setUp() self.build_args.extend(["--base", "centos", "--type", "source"]) -class BuildTestUbuntuSource(BuildTest): +class BuildTestUbuntuSource(BuildTest, base.BaseTestCase): + excluded_images = [] + def setUp(self): super(BuildTestUbuntuSource, self).setUp() self.build_args.extend(["--base", "ubuntu", "--type", "source"]) -class DeployTestCentosBinary(BuildTest): +class DeployTestCentosBinary(BuildTestCentosBinary): def setUp(self): super(DeployTestCentosBinary, self).setUp() - self.build_args.extend(["--base", "centos", - "--type", "binary", - "--profile", "gate"]) + self.build_args.extend(["--profile", "gate"]) -class DeployTestCentosSource(BuildTest): +class DeployTestCentosSource(BuildTestCentosSource): def setUp(self): super(DeployTestCentosSource, self).setUp() - self.build_args.extend(["--base", "centos", - "--type", "source", - "--profile", "gate"]) + self.build_args.extend(["--profile", "gate"]) -class DeployTestUbuntuSource(BuildTest): +class DeployTestUbuntuSource(BuildTestUbuntuSource): def setUp(self): super(DeployTestUbuntuSource, self).setUp() - self.build_args.extend(["--base", "ubuntu", - "--type", "source", - "--profile", "gate"]) + self.build_args.extend(["--profile", "gate"])