diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-08-07 12:14:41 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-08-07 13:41:40 +0100 |
commit | edc50cf457a92575a22e202e648d64b0ef1a3527 (patch) | |
tree | ab32524630bf0b3480761ef2c3a338b054ce29f8 /morphlib/morphologyfactory_tests.py | |
parent | 131d8744eb68c75deb491fb3ce39c83851c64ae3 (diff) | |
download | morph-edc50cf457a92575a22e202e648d64b0ef1a3527.tar.gz |
morphologyfactory: validate stratum build-depends
A stratum morphology must either have stratum build-depends, or
have some bootstrap chunks, otherwise there's no way to have the
required set of commands to be able to build chunks.
A concession has been made to also allow strata that contain chunks
built in test mode, but this opens a reproducibility hole.
Unit tests for these failures have been added, and the stratum
used by other unit tests has been fixed.
Diffstat (limited to 'morphlib/morphologyfactory_tests.py')
-rw-r--r-- | morphlib/morphologyfactory_tests.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py index de1be017..06489085 100644 --- a/morphlib/morphologyfactory_tests.py +++ b/morphlib/morphologyfactory_tests.py @@ -63,6 +63,7 @@ class FakeLocalRepo(object): "name": "chunk", "repo": "test:repo", "ref": "sha1", + "build-mode": "bootstrap", "build-depends": [] } ] @@ -79,6 +80,37 @@ class FakeLocalRepo(object): } ] }''', + 'stratum-no-bdeps-no-bootstrap.morph': '''{ + "name": "stratum-no-bdeps-no-bootstrap", + "kind": "stratum", + "chunks": [ + { + "name": "chunk", + "repo": "test:repo", + "ref": "sha1", + "build-depends": [] + } + ] + }''', + 'stratum-bdeps-no-bootstrap.morph': '''{ + "name": "stratum-bdeps-no-bootstrap", + "kind": "stratum", + "build-depends": [ + { + "repo": "test:repo", + "ref": "sha1", + "morph": "stratum" + } + ], + "chunks": [ + { + "name": "chunk", + "repo": "test:repo", + "ref": "sha1", + "build-depends": [] + } + ] + }''', 'stratum-empty.morph': '''{ "name": "stratum-empty", "kind": "stratum" @@ -290,6 +322,17 @@ class MorphologyFactoryTests(unittest.TestCase): self.mf.get_morphology, 'reponame', 'sha1', 'stratum-no-chunk-bdeps.morph') + def test_fails_on_no_bdeps_or_bootstrap(self): + self.assertRaises( + morphlib.morphologyfactory.NoStratumBuildDependsError, + self.mf.get_morphology, 'reponame', 'sha1', + 'stratum-no-bdeps-no-bootstrap.morph') + + def test_succeeds_on_bdeps_no_bootstrap(self): + self.mf.get_morphology( + 'reponame', 'sha1', + 'stratum-bdeps-no-bootstrap.morph') + def test_fails_on_empty_stratum(self): self.assertRaises( morphlib.morphologyfactory.EmptyStratumError, |