diff options
| author | Jeff Peeler <jpeeler@redhat.com> | 2015-08-13 18:13:52 -0400 |
|---|---|---|
| committer | Jeff Peeler <jpeeler@redhat.com> | 2015-08-14 11:46:37 -0400 |
| commit | f33f5913a3a8756679b98f70aa8a3a5719cd2bfe (patch) | |
| tree | d49d3e8207636f7b0693f65da7ca9bc2e92ab661 | |
| parent | b36abefd8f5e92c7792c7a8eb12f012f9f45e160 (diff) | |
| download | kolla-f33f5913a3a8756679b98f70aa8a3a5719cd2bfe.tar.gz kolla-f33f5913a3a8756679b98f70aa8a3a5719cd2bfe.zip | |
Use inheritance for overriding of builder args
This establishes a pattern for adding any number of combinations for the
new build script to use. Each individual test class may be called
separately to only do builds of a select type. An example testr command
looks like:
testr run '^(test_build.BuildTestCentosBinary)' or even more simply
testr run test_build.BuildTestCentosBinary
Change-Id: I828a8c9c36a771bd5ad23e0dee6dffe3e94067e1
Paritally-Implements: blueprint gate-source-builds
| -rw-r--r-- | tests/test_build.py | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/tests/test_build.py b/tests/test_build.py index 0bfaad275..03a15e6c4 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -30,10 +30,11 @@ class BuildTest(base.BaseTestCase): super(BuildTest, self).setUp() self.useFixture(log_fixture.SetLogLevel([__name__], logging.logging.INFO)) + self.build_args = [__name__, "--debug"] - def test_build(self): - build_args = ["--debug"] - with patch.object(sys, 'argv', build_args): + def runTest(self): + with patch.object(sys, 'argv', self.build_args): + LOG.info("Running with args %s" % self.build_args) bad_results, good_results = build.main() # these are images that are known to not build properly @@ -57,3 +58,33 @@ class BuildTest(base.BaseTestCase): LOG.critical(">>> Expected image '%s' to succeed!" % image) self.assertEqual(failures, 0, "%d failure(s) occurred" % failures) + + +class BuildTestCentosBinary(BuildTest): + def setUp(self): + super(BuildTestCentosBinary, self).setUp() + self.build_args.extend(["--base", "centos", + "--type", "binary"]) + + +class BuildTestTemplateCentosBinary(BuildTest): + def setUp(self): + super(BuildTestCentosBinary, self).setUp() + self.build_args.extend(["--base", "centos", + "--type", "binary", + "--template"]) + + +class BuildTestCentosSource(BuildTest): + def setUp(self): + super(BuildTestCentosSource, self).setUp() + self.build_args.extend(["--base", "centos", + "--type", "source"]) + + +class BuildTestTemplateCentosSource(BuildTest): + def setUp(self): + super(BuildTestCentosSource, self).setUp() + self.build_args.extend(["--base", "centos", + "--type", "source", + "--template"]) |
