summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-07-03 17:04:09 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-07-03 17:04:52 +0000
commit6b0703a908e82dddd6c1a0cc8a944ba46ad96657 (patch)
tree3bc60dd092508278114078f75997c9d9c6f42769 /morphlib
parent1eff90528732e9c6ffbad03ca30adecbf11f87f7 (diff)
downloadmorph-6b0703a908e82dddd6c1a0cc8a944ba46ad96657.tar.gz
tests: fix up for change in artifact name
This fixes references to a system artifact without the -rootfs appended and adds a unit test for resolving an arm system artifact.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/artifactresolver_tests.py28
-rw-r--r--morphlib/cachekeycomputer_tests.py8
2 files changed, 30 insertions, 6 deletions
diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py
index 467c882d..5dc7f29a 100644
--- a/morphlib/artifactresolver_tests.py
+++ b/morphlib/artifactresolver_tests.py
@@ -187,10 +187,34 @@ class ArtifactResolverTests(unittest.TestCase):
artifacts = self.resolver.resolve_artifacts(pool)
self.assertEqual(artifacts[0].source, system)
- self.assertEqual(artifacts[0].name, 'foo')
+ self.assertEqual(artifacts[0].name, 'foo-rootfs')
self.assertEqual(artifacts[0].dependencies, [])
self.assertEqual(artifacts[0].dependents, [])
+ def test_resolve_a_single_empty_arm_system(self):
+ pool = morphlib.sourcepool.SourcePool()
+
+ morph = morphlib.morph2.Morphology(
+ '''
+ {
+ "name": "foo",
+ "kind": "system",
+ "arch": "arm"
+ }
+ ''')
+ system = morphlib.source.Source(
+ 'repo', 'original/ref', 'sha1', morph, 'foo.morph')
+ pool.add(system)
+
+ artifacts = self.resolver.resolve_artifacts(pool)
+
+ self.assertTrue(any((a.source == system and a.name == 'foo-rootfs' and
+ a.dependencies == [] and a.dependents == [])
+ for a in artifacts))
+ self.assertTrue(any((a.source == system and a.name == 'foo-kernel' and
+ a.dependencies == [] and a.dependents == [])
+ for a in artifacts))
+
def test_resolve_stratum_and_chunk_with_no_subartifacts(self):
pool = morphlib.sourcepool.SourcePool()
@@ -447,7 +471,7 @@ class ArtifactResolverTests(unittest.TestCase):
self.assertEqual(artifacts[0].dependents, [artifacts[1], artifacts[2]])
self.assertEqual(artifacts[1].source, system)
- self.assertEqual(artifacts[1].name, 'system')
+ self.assertEqual(artifacts[1].name, 'system-rootfs')
self.assertEqual(artifacts[1].dependencies,
[artifacts[0], artifacts[2]])
self.assertEqual(artifacts[1].dependents, [])
diff --git a/morphlib/cachekeycomputer_tests.py b/morphlib/cachekeycomputer_tests.py
index 807fbe89..82d3e6e5 100644
--- a/morphlib/cachekeycomputer_tests.py
+++ b/morphlib/cachekeycomputer_tests.py
@@ -117,7 +117,7 @@ class CacheKeyComputerTests(unittest.TestCase):
self.ckc._hash_list = inccount(self.ckc._hash_list, 'list')
self.ckc._hash_tuple = inccount(self.ckc._hash_tuple, 'tuple')
- artifact = self._find_artifact('system')
+ artifact = self._find_artifact('system-rootfs')
self.ckc.compute_key(artifact)
self.assertNotEqual(runcount['thing'], 0)
@@ -130,12 +130,12 @@ class CacheKeyComputerTests(unittest.TestCase):
return len(s) == 64 and all([c in validchars for c in s])
def test_compute_key_returns_sha256(self):
- artifact = self._find_artifact('system')
+ artifact = self._find_artifact('system-rootfs')
self.assertTrue(self._valid_sha256(
self.ckc.compute_key(artifact)))
def test_different_env_gives_different_key(self):
- artifact = self._find_artifact('system')
+ artifact = self._find_artifact('system-rootfs')
oldsha = self.ckc.compute_key(artifact)
build_env = DummyBuildEnvironment({
"USER": "foouser",
@@ -150,7 +150,7 @@ class CacheKeyComputerTests(unittest.TestCase):
self.assertNotEqual(oldsha, ckc.compute_key(artifact))
def test_same_morphology_text_but_changed_sha1_gives_same_cache_key(self):
- old_artifact = self._find_artifact('system')
+ old_artifact = self._find_artifact('system-rootfs')
morphology = old_artifact.source.morphology
new_source = morphlib.source.Source('repo', 'original/ref', 'newsha',
morphology,