summaryrefslogtreecommitdiff
path: root/morphlib/artifactresolver_tests.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-08-28 17:20:04 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-08-30 11:19:01 +0000
commit2a071ef057c953e81e1b8bd9b714373b4dbb26c2 (patch)
treebffd06cb8a9d0c825cdc2274b7b4c55adc07def6 /morphlib/artifactresolver_tests.py
parentecefb2d1936221ccf21cbad6db2fe73cd229f4f5 (diff)
downloadmorph-2a071ef057c953e81e1b8bd9b714373b4dbb26c2.tar.gz
Strata should be referred to with full repo/ref/morph triplets
This removes the requirement that all strata must be in the same repo as the system morphology. Both the system "strata" field and the stratum "build-depends" field are affected.
Diffstat (limited to 'morphlib/artifactresolver_tests.py')
-rw-r--r--morphlib/artifactresolver_tests.py63
1 files changed, 42 insertions, 21 deletions
diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py
index 952ffd85..65a9be7d 100644
--- a/morphlib/artifactresolver_tests.py
+++ b/morphlib/artifactresolver_tests.py
@@ -51,19 +51,26 @@ class FakeChunkMorphology(morphlib.morph2.Morphology):
class FakeStratumMorphology(morphlib.morph2.Morphology):
- def __init__(self, name, source_list=[], build_depends=[]):
- assert(isinstance(source_list, list))
- assert(isinstance(build_depends, list))
-
- if source_list:
- chunks = []
- for source_name, morph, repo, ref in source_list:
- chunks.append({
- 'name': source_name,
- 'morph': morph,
- 'repo': repo,
- 'ref': ref
- })
+ def __init__(self, name, chunks_list=[], build_depends_list=[]):
+ assert(isinstance(chunks_list, list))
+ assert(isinstance(build_depends_list, list))
+
+ chunks = []
+ for source_name, morph, repo, ref in chunks_list:
+ chunks.append({
+ 'name': source_name,
+ 'morph': morph,
+ 'repo': repo,
+ 'ref': ref
+ })
+ build_depends = []
+ for morph, repo, ref in build_depends_list:
+ build_depends.append({
+ 'morph': morph,
+ 'repo': repo,
+ 'ref': ref
+ })
+ if chunks:
text = ('''
{
"name": "%s",
@@ -367,7 +374,8 @@ class ArtifactResolverTests(unittest.TestCase):
'repo', 'ref', 'sha1', morph, 'stratum1.morph')
pool.add(stratum1)
- morph = FakeStratumMorphology('stratum2', [], ['stratum1'])
+ morph = FakeStratumMorphology(
+ 'stratum2', [], [('stratum1', 'repo', 'ref')])
stratum2 = morphlib.source.Source(
'repo', 'ref', 'sha1', morph, 'stratum2.morph')
pool.add(stratum2)
@@ -398,7 +406,9 @@ class ArtifactResolverTests(unittest.TestCase):
'stratum2', [
('chunk1', 'chunk1', 'repo', 'original/ref'),
('chunk2', 'chunk2', 'repo', 'original/ref')
- ], ['stratum1'])
+ ], [
+ ('stratum1', 'repo', 'original/ref')
+ ])
stratum2 = morphlib.source.Source(
'repo', 'original/ref', 'sha1', morph, 'stratum2.morph')
pool.add(stratum2)
@@ -454,8 +464,16 @@ class ArtifactResolverTests(unittest.TestCase):
"name": "system",
"kind": "system",
"strata": [
- "stratum1",
- "stratum2"
+ {
+ "repo": "repo",
+ "ref": "ref",
+ "morph": "stratum1"
+ },
+ {
+ "repo": "repo",
+ "ref": "ref",
+ "morph": "stratum2"
+ }
]
}
''')
@@ -464,7 +482,8 @@ class ArtifactResolverTests(unittest.TestCase):
'repo', 'ref', 'sha1', morph, 'system.morph')
pool.add(system)
- morph = FakeStratumMorphology('stratum2', [], ['stratum1'])
+ morph = FakeStratumMorphology(
+ 'stratum2', [], [('stratum1', 'repo', 'ref')])
stratum2 = morphlib.source.Source(
'repo', 'ref', 'sha1', morph, 'stratum2.morph')
pool.add(stratum2)
@@ -592,12 +611,14 @@ class ArtifactResolverTests(unittest.TestCase):
def test_detection_of_mutual_dependency_between_two_strata(self):
pool = morphlib.sourcepool.SourcePool()
- morph = FakeStratumMorphology('stratum1', [], ['stratum2'])
+ morph = FakeStratumMorphology(
+ 'stratum1', [], [('stratum2', 'repo', 'original/ref')])
stratum1 = morphlib.source.Source(
'repo', 'original/ref', 'sha1', morph, 'stratum1.morph')
pool.add(stratum1)
- morph = FakeStratumMorphology('stratum2', [], ['stratum1'])
+ morph = FakeStratumMorphology(
+ 'stratum2', [], [('stratum1', 'repo', 'original/ref')])
stratum2 = morphlib.source.Source(
'repo', 'original/ref', 'sha1', morph, 'stratum2.morph')
pool.add(stratum2)
@@ -621,7 +642,7 @@ class ArtifactResolverTests(unittest.TestCase):
'stratum2', [
('chunk2', 'chunk2', 'repo', 'original/ref'),
('chunk1', 'chunk1', 'repo', 'original/ref')
- ], ['stratum1'])
+ ], [('stratum1', 'repo', 'original/ref')])
stratum2 = morphlib.source.Source(
'repo', 'original/ref', 'sha1', morph, 'stratum2.morph')
pool.add(stratum2)