Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2014-05-02 16:51:37 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2014-05-02 16:51:37 (GMT)
commita57e9537c034ee4566f8cf694518619588097f76 (patch)
tree987bab7ac33070beb5d4286bab32eade82ad01f3
parenta625f7b3bea0de2d2effe56e116e512c3ea405fb (diff)
Return blob urls in solve API command
-rw-r--r--sugar_network/client/injector.py18
-rw-r--r--sugar_network/node/model.py27
-rwxr-xr-xtests/units/client/client_routes.py6
-rwxr-xr-xtests/units/client/injector.py8
-rwxr-xr-xtests/units/node/node_model.py233
-rwxr-xr-xtests/units/node/node_routes.py8
6 files changed, 160 insertions, 140 deletions
diff --git a/sugar_network/client/injector.py b/sugar_network/client/injector.py
index fcd87ea..8b3fd8e 100644
--- a/sugar_network/client/injector.py
+++ b/sugar_network/client/injector.py
@@ -98,7 +98,7 @@ class Injector(object):
self._progress_in(ctx)
releases.extend(solution.values())
release = solution[ctx]
- return release, self._pool.path(release['blob'])
+ return release, self._pool.path(release['blob'].split('/')[-1])
try:
yield {'event': 'launch', 'state': 'solve'}
@@ -258,8 +258,10 @@ class Injector(object):
size = 0
for release in solution:
- digest = release.get('blob')
- if not digest or exists(self._pool.path(digest)):
+ if 'blob' not in release:
+ continue
+ digest = release.get('blob').split('/')[-1]
+ if exists(self._pool.path(digest)):
continue
enforce(self._api is not None, 'Cannot download in offline')
download_size = max(download_size, release['size'])
@@ -338,9 +340,9 @@ class _PreemptivePool(object):
if self._lru is None:
self._init()
for release in solution:
- digest = release.get('blob')
- if not digest:
+ if 'blob' not in release:
continue
+ digest = release.get('blob').split('/')[-1]
path = join(self._root, digest)
if not exists(path):
continue
@@ -354,8 +356,10 @@ class _PreemptivePool(object):
self._init()
found = False
for release in solution:
- digest = release.get('blob')
- if digest and digest in self._lru:
+ if 'blob' not in release:
+ continue
+ digest = release.get('blob').split('/')[-1]
+ if digest in self._lru:
self._pop(digest, False)
found = True
return found
diff --git a/sugar_network/node/model.py b/sugar_network/node/model.py
index 5d42583..87abed6 100644
--- a/sugar_network/node/model.py
+++ b/sugar_network/node/model.py
@@ -315,11 +315,11 @@ def solve(volume, top_context, command=None, lsb_id=None, lsb_release=None,
top_context.guid, lsb_id, lsb_release, stability, top_requires,
assume)
- def rate_release(digest, release):
+ def rate_release(key, release):
return [command in release.get('commands', []),
_STABILITY_RATES.get(release['stability']) or 0,
release['version'],
- digest,
+ key,
]
def add_deps(v_usage, deps):
@@ -361,7 +361,7 @@ def solve(volume, top_context, command=None, lsb_id=None, lsb_release=None,
varset.append((context.guid, pkg_info))
else:
candidates = []
- for digest, release in releases.items():
+ for key, release in releases.items():
if 'value' not in release:
continue
release = release['value']
@@ -369,21 +369,24 @@ def solve(volume, top_context, command=None, lsb_id=None, lsb_release=None,
context.guid == top_context.guid and \
not ensure_version(release['version'], top_cond):
continue
- bisect.insort(candidates, rate_release(digest, release))
+ bisect.insort(candidates, rate_release(key, release))
for release in reversed(candidates):
- digest = release[-1]
- release = releases[digest]['value']
+ release = releases[release[-1]]['value']
+ # TODO Assume we have only noarch bundles
+ bundle = release['bundles']['*-*']
+ blob = volume.blobs.get(bundle['blob'])
+ if blob is None:
+ _logger.debug('Absent blob for %r release', release)
+ continue
release_info = {
'title': i18n.decode(context['title'],
this.request.accept_language),
'version': release['version'],
- 'blob': digest,
+ 'blob': blob,
+ 'size': blob.size,
+ 'content-type': blob.meta['content-type'],
}
- blob = volume.blobs.get(digest)
- if blob is not None:
- release_info['size'] = blob.size
- release_info['content-type'] = blob.meta['content-type']
- unpack_size = release['bundles']['*-*'].get('unpack_size')
+ unpack_size = bundle.get('unpack_size')
if unpack_size is not None:
release_info['unpack_size'] = unpack_size
requires = release.get('requires') or {}
diff --git a/tests/units/client/client_routes.py b/tests/units/client/client_routes.py
index 863d1af..2f544a3 100755
--- a/tests/units/client/client_routes.py
+++ b/tests/units/client/client_routes.py
@@ -712,7 +712,7 @@ class ClientRoutesTest(tests.Test):
{'activity_id': 'activity_id'},
{'event': 'launch', 'state': 'init'},
{'event': 'launch', 'state': 'solve'},
- {'error': 'Context not found', 'event': 'failure', 'exception': 'NotFound'},
+ {'error': 'Failed to solve', 'event': 'failure', 'exception': 'RuntimeError'},
],
[i for i in ipc.get(['context', 'context'], cmd='launch')])
@@ -758,7 +758,7 @@ class ClientRoutesTest(tests.Test):
],
'solution': {
'context2': {
- 'blob': release,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + release,
'command': ['activity', 'false'],
'content-type': 'application/vnd.olpc-sugar',
'size': len(activity_bundle),
@@ -808,7 +808,7 @@ class ClientRoutesTest(tests.Test):
],
'solution': {
'context2': {
- 'blob': release,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + release,
'command': ['activity', 'false'],
'content-type': 'application/vnd.olpc-sugar',
'size': len(activity_bundle),
diff --git a/tests/units/client/injector.py b/tests/units/client/injector.py
index 2f2cdef..69b916f 100755
--- a/tests/units/client/injector.py
+++ b/tests/units/client/injector.py
@@ -370,7 +370,7 @@ class InjectorTest(tests.Test):
solution = {
'context': {
- 'blob': release,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + release,
'command': ['activity', 'true'],
'content-type': 'application/vnd.olpc-sugar',
'size': len(activity_bundle),
@@ -426,7 +426,7 @@ class InjectorTest(tests.Test):
conn.delete(['context', 'context'])
assert 'context' in injector._solve('context', 'stable')
os.unlink('client/solutions/context')
- self.assertRaises(http.NotFound, injector._solve, 'context', 'stable')
+ self.assertRaises(RuntimeError, injector._solve, 'context', 'stable')
def test_solve_InvalidateCachedSolution(self):
self.fork_master()
@@ -592,7 +592,7 @@ class InjectorTest(tests.Test):
'unpack_size': len(activity_info),
'version': [[1], 0],
'command': ['activity', 'true'],
- 'blob': release,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + release,
'size': len(activity_bundle),
'content-type': 'application/vnd.olpc-sugar',
}}],
@@ -734,7 +734,7 @@ class InjectorTest(tests.Test):
'title': 'Activity',
'command': ['activity', 'true'],
'content-type': 'application/vnd.olpc-sugar',
- 'blob': hashlib.sha1(activity_bundle).hexdigest(),
+ 'blob': 'http://127.0.0.1:7777/blobs/' + hashlib.sha1(activity_bundle).hexdigest(),
'size': len(activity_bundle),
'unpack_size': len(activity_info),
'version': [[1], 0],
diff --git a/tests/units/node/node_model.py b/tests/units/node/node_model.py
index a4f5c86..afb42cd 100755
--- a/tests/units/node/node_model.py
+++ b/tests/units/node/node_model.py
@@ -1364,53 +1364,56 @@ class NodeModelTest(tests.Test):
def test_solve_SortByVersions(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
context = volume['context'].create({
'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
},
})
self.assertEqual(
- {context: {'command': ('activity', 3), 'title': '', 'blob': '3', 'version': [[3], 0]}},
+ {context: {'command': ('activity', 3), 'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'}},
model.solve(volume, context))
context = volume['context'].create({
'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
},
})
self.assertEqual(
- {context: {'command': ('activity', 3), 'title': '', 'blob': '3', 'version': [[3], 0]}},
+ {context: {'command': ('activity', 3), 'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'}},
model.solve(volume, context))
def test_solve_SortByStability(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
context = volume['context'].create({
'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'developer', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'buggy', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'developer', 'version': [[1], 0], 'commands': {'activity': {'exec': 1}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 2}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'buggy', 'version': [[3], 0], 'commands': {'activity': {'exec': 3}}}},
},
})
self.assertEqual(
- {context: {'command': ('activity', 2), 'title': '', 'blob': '2', 'version': [[2], 0]}},
+ {context: {'command': ('activity', 2), 'title': '', 'blob': 'None/blobs/2', 'version': [[2], 0], 'size': 0, 'content-type': 'mime'}},
model.solve(volume, context))
def test_solve_CollectDeps(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
'1': {'value': {
- 'bundles': {'*-*': {}}, 'stability': 'stable',
+ 'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable',
'version': [[1], 0],
'requires': spec.parse_requires('context2; context4'),
'commands': {'activity': {'exec': 'command'}},
@@ -1420,7 +1423,7 @@ class NodeModelTest(tests.Test):
volume['context'].create({
'guid': 'context2', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
'2': {'value': {
- 'bundles': {'*-*': {}}, 'stability': 'stable',
+ 'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable',
'version': [[2], 0],
'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('context3'),
@@ -1429,31 +1432,32 @@ class NodeModelTest(tests.Test):
})
volume['context'].create({
'guid': 'context3', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
volume['context'].create({
'guid': 'context4', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '1', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'context2': {'title': '', 'blob': '2', 'version': [[2], 0]},
- 'context3': {'title': '', 'blob': '3', 'version': [[3], 0]},
- 'context4': {'title': '', 'blob': '4', 'version': [[4], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'context2': {'title': '', 'blob': 'None/blobs/2', 'version': [[2], 0], 'size': 0, 'content-type': 'mime'},
+ 'context3': {'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'},
+ 'context4': {'title': '', 'blob': 'None/blobs/4', 'version': [[4], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
def test_solve_CommandDeps(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
'1': {'value': {
- 'bundles': {'*-*': {}}, 'stability': 'stable',
+ 'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable',
'version': [[1], 0],
'requires': [],
'commands': {
@@ -1466,7 +1470,7 @@ class NodeModelTest(tests.Test):
volume['context'].create({
'guid': 'context2', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
'2': {'value': {
- 'bundles': {'*-*': {}}, 'stability': 'stable',
+ 'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable',
'version': [[2], 0],
'commands': {'activity': {'exec': 0}},
'requires': [],
@@ -1475,168 +1479,171 @@ class NodeModelTest(tests.Test):
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '1', 'version': [[1], 0], 'command': ('activity', 1)},
- 'context2': {'title': '', 'blob': '2', 'version': [[2], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 1), 'size': 0, 'content-type': 'mime'},
+ 'context2': {'title': '', 'blob': 'None/blobs/2', 'version': [[2], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1', command='activity'))
self.assertEqual({
- 'context1': {'title': '', 'blob': '1', 'version': [[1], 0], 'command': ('application', 2)},
+ 'context1': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('application', 2), 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1', command='application'))
def test_solve_DepConditions(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'dep', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
- '5': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
+ '5': {'value': {'bundles': {'*-*': {'blob': '5'}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep < 3'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '2', 'version': [[2], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/2', 'version': [[2], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep <= 3'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '3', 'version': [[3], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep > 2'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '5', 'version': [[5], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/5', 'version': [[5], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep >= 2'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '5', 'version': [[5], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/5', 'version': [[5], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep > 2; dep < 5'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '4', 'version': [[4], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/4', 'version': [[4], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep > 2; dep <= 3'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '3', 'version': [[3], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep = 1'),
}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '1', 'version': [[1], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
def test_solve_SwitchToAlternativeBranch(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'context1', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '6': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
+ '6': {'value': {'bundles': {'*-*': {'blob': '6'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('context4=1'), 'commands': {'activity': {'exec': 6}}}},
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('context2'), 'commands': {'activity': {'exec': 1}}}},
},
})
volume['context'].create({
'guid': 'context2', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('context3; context4=1')}},
},
})
volume['context'].create({
'guid': 'context3', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('context4=2')}},
},
})
volume['context'].create({
'guid': 'context4', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
- '5': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
+ '5': {'value': {'bundles': {'*-*': {'blob': '5'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
self.assertEqual({
- 'context1': {'title': '', 'blob': '6', 'version': [[1], 0], 'command': ('activity', 6)},
- 'context4': {'title': '', 'blob': '5', 'version': [[1], 0]},
+ 'context1': {'title': '', 'blob': 'None/blobs/6', 'version': [[1], 0], 'command': ('activity', 6), 'size': 0, 'content-type': 'mime'},
+ 'context4': {'title': '', 'blob': 'None/blobs/5', 'version': [[1], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context1'))
def test_solve_CommonDeps(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'dep', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
- '5': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
+ '5': {'value': {'bundles': {'*-*': {'blob': '5'}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
@@ -1644,14 +1651,14 @@ class NodeModelTest(tests.Test):
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {},
'dependencies': 'dep=2',
'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires(''),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '2', 'version': [[2], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/2', 'version': [[2], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
@@ -1659,14 +1666,14 @@ class NodeModelTest(tests.Test):
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {},
'dependencies': 'dep<5',
'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep>1'),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '4', 'version': [[4], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/4', 'version': [[4], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
@@ -1674,66 +1681,67 @@ class NodeModelTest(tests.Test):
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {},
'dependencies': 'dep<4',
'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep<5'),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '3', 'version': [[3], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/3', 'version': [[3], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
def test_solve_ExtraDeps(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'dep', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
- '5': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
+ '5': {'value': {'bundles': {'*-*': {'blob': '5'}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires(''),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep>1'),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '5', 'version': [[5], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/5', 'version': [[5], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep<5'),
}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '10', 'version': [[1], 0], 'command': ('activity', 'command')},
- 'dep': {'title': '', 'blob': '4', 'version': [[4], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/10', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/4', 'version': [[4], 0], 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
@@ -1744,11 +1752,11 @@ class NodeModelTest(tests.Test):
volume['context'].create({
'guid': 'dep', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
- '3': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
- '4': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
- '5': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}}}},
+ '3': {'value': {'bundles': {'*-*': {'blob': '3'}}, 'stability': 'stable', 'version': [[3], 0], 'commands': {'activity': {'exec': 0}}}},
+ '4': {'value': {'bundles': {'*-*': {'blob': '4'}}, 'stability': 'stable', 'version': [[4], 0], 'commands': {'activity': {'exec': 0}}}},
+ '5': {'value': {'bundles': {'*-*': {'blob': '5'}}, 'stability': 'stable', 'version': [[5], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
@@ -1760,7 +1768,7 @@ class NodeModelTest(tests.Test):
volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '10': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '10': {'value': {'bundles': {'*-*': {'blob': '10'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep=0'),
}},
},
@@ -1769,12 +1777,13 @@ class NodeModelTest(tests.Test):
def test_solve_Packages(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
this.request = Request()
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('package'),
}},
},
@@ -1787,38 +1796,39 @@ class NodeModelTest(tests.Test):
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package': {'packages': ['pkg1', 'pkg2'], 'version': [[1], 0]},
},
model.solve(volume, context, lsb_id='Ubuntu', lsb_release='10.04'))
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('dep; package'),
}},
},
})
volume['context'].create({
'guid': 'dep', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}}}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
- 'dep': {'title': '', 'blob': '2', 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
+ 'dep': {'title': '', 'blob': 'None/blobs/2', 'version': [[1], 0], 'size': 0, 'content-type': 'mime'},
'package': {'packages': ['pkg1', 'pkg2'], 'version': [[1], 0]},
},
model.solve(volume, context, lsb_id='Ubuntu', lsb_release='10.04'))
def test_solve_PackagesByLsbId(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
this.request = Request()
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('package1'),
}},
},
@@ -1829,14 +1839,14 @@ class NodeModelTest(tests.Test):
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package1': {'packages': ['bin1', 'bin2'], 'version': []},
},
model.solve(volume, context, lsb_id='Ubuntu'))
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('package2'),
}},
},
@@ -1850,19 +1860,20 @@ class NodeModelTest(tests.Test):
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package2': {'packages': ['bin'], 'version': []},
},
model.solve(volume, context, lsb_id='Ubuntu', lsb_release='fake'))
def test_solve_PackagesByCommonAlias(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
this.request = Request()
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('package1'),
}},
},
@@ -1877,29 +1888,30 @@ class NodeModelTest(tests.Test):
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package1': {'packages': ['pkg1'], 'version': []},
},
model.solve(volume, context))
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package1': {'packages': ['pkg1'], 'version': []},
},
model.solve(volume, context, lsb_id='Fake'))
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'command': ('activity', 'command'), 'version': [[1], 0]},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 'command'), 'size': 0, 'content-type': 'mime'},
'package1': {'packages': ['pkg1'], 'version': []},
},
model.solve(volume, context, lsb_id='Fake', lsb_release='fake'))
def test_solve_NoPackages(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
this.request = Request()
context = volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 'command'}},
'requires': spec.parse_requires('package'),
}},
},
@@ -1912,19 +1924,20 @@ class NodeModelTest(tests.Test):
def test_solve_IgnoreAbsentContexts(self):
volume = Volume('master', [Context])
+ volume.blobs.get = lambda digest: File(digest=digest, meta={'content-length': '0', 'content-type': 'mime'})
this.volume = volume
volume['context'].create({
'guid': 'context', 'type': ['activity'], 'title': {}, 'summary': {}, 'description': {}, 'releases': {
- '2': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}},
+ '2': {'value': {'bundles': {'*-*': {'blob': '2'}}, 'stability': 'stable', 'version': [[2], 0], 'commands': {'activity': {'exec': 0}},
'requires': spec.parse_requires('absent'), 'commands': {'activity': {'exec': 2}}}},
- '1': {'value': {'bundles': {'*-*': {}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
+ '1': {'value': {'bundles': {'*-*': {'blob': '1'}}, 'stability': 'stable', 'version': [[1], 0], 'commands': {'activity': {'exec': 0}},
'commands': {'activity': {'exec': 1}}}},
},
})
self.assertEqual({
- 'context': {'title': '', 'blob': '1', 'version': [[1], 0], 'command': ('activity', 1)},
+ 'context': {'title': '', 'blob': 'None/blobs/1', 'version': [[1], 0], 'command': ('activity', 1), 'size': 0, 'content-type': 'mime'},
},
model.solve(volume, 'context'))
diff --git a/tests/units/node/node_routes.py b/tests/units/node/node_routes.py
index fb7b1c7..77b57cc 100755
--- a/tests/units/node/node_routes.py
+++ b/tests/units/node/node_routes.py
@@ -630,7 +630,7 @@ class NodeRoutesTest(tests.Test):
self.assertEqual({
'activity': {
'title': 'activity',
- 'blob': activity_blob,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + activity_blob,
'command': ['activity', 'true'],
'version': [[1], 0],
'size': len(activity_pack),
@@ -639,7 +639,7 @@ class NodeRoutesTest(tests.Test):
},
'dep': {
'title': 'dep',
- 'blob': dep_blob,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + dep_blob,
'version': [[2], 0],
'size': len(dep_pack),
'unpack_size': len(dep_unpack),
@@ -710,7 +710,7 @@ class NodeRoutesTest(tests.Test):
self.assertEqual({
'activity': {
'title': 'activity',
- 'blob': activity_blob,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + activity_blob,
'command': ['activity', 'true'],
'version': [[1], 0],
'size': len(activity_pack),
@@ -719,7 +719,7 @@ class NodeRoutesTest(tests.Test):
},
'dep': {
'title': 'dep',
- 'blob': dep_blob,
+ 'blob': 'http://127.0.0.1:7777/blobs/' + dep_blob,
'version': [[2], 0],
'size': len(dep_pack),
'unpack_size': len(dep_unpack),