aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_build.py59
1 files changed, 32 insertions, 27 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index 86bcbf7d9..eda87a4e7 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"])