Merge lp:~cprov/snappy-proposed-selftest-agent/source-binaries into lp:snappy-proposed-selftest-agent

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 15
Merged at revision: 14
Proposed branch: lp:~cprov/snappy-proposed-selftest-agent/source-binaries
Merge into: lp:snappy-proposed-selftest-agent
Diff against target: 106 lines (+36/-23)
2 files modified
snappy_proposed_selftest_agent/tests/test_worker.py (+16/-3)
snappy_proposed_selftest_agent/worker.py (+20/-20)
To merge this branch: bzr merge lp:~cprov/snappy-proposed-selftest-agent/source-binaries
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+260573@code.launchpad.net

Commit message

Using 'source_binaries' payload provided by Britney.

Description of the change

Using 'source_binaries' payload provided by Britney from https://code.launchpad.net/~cprov/britney/source-binaries/+merge/260540

To post a comment you must log in.
15. By Celso Providelo

Including 'image_binaries' in the payload, to be zipped with 'source_version' in the image-builder to ensure the rootfs contains the required binaries for this test.

Revision history for this message
Paul Larson (pwlars) wrote :

This looks great, thanks! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snappy_proposed_selftest_agent/tests/test_worker.py'
--- snappy_proposed_selftest_agent/tests/test_worker.py 2015-05-29 01:57:53 +0000
+++ snappy_proposed_selftest_agent/tests/test_worker.py 2015-05-29 13:41:36 +0000
@@ -29,7 +29,7 @@
29 mock_fetch_manifest.return_value = {}29 mock_fetch_manifest.return_value = {}
30 conn = kombu.Connection('memory:///')30 conn = kombu.Connection('memory:///')
31 queue_message(conn, {'test': 'value',31 queue_message(conn, {'test': 'value',
32 'source_name': 'foo',32 'source_binaries': ['foo'],
33 'series': 'wily'})33 'series': 'wily'})
3434
35 build_worker = LoggingConsumer()35 build_worker = LoggingConsumer()
@@ -43,9 +43,15 @@
4343
44 @mock.patch.object(CoreSelftestAgentWorker, '_fetch_manifest')44 @mock.patch.object(CoreSelftestAgentWorker, '_fetch_manifest')
45 def test_package_in_manifest(self, mock_fetch_manifest):45 def test_package_in_manifest(self, mock_fetch_manifest):
46 mock_fetch_manifest.return_value = {'foo': '1.0'}46 mock_fetch_manifest.return_value = {
47 'foo': '1.0',
48 'bar': '1.0',
49 }
47 conn = kombu.Connection('memory:///')50 conn = kombu.Connection('memory:///')
48 queue_message(conn, {'source_name': 'foo', 'series': 'wily'})51 queue_message(conn, {
52 'source_binaries': ['foo', 'bar', 'baz'],
53 'series': 'wily',
54 })
49 build_worker = LoggingConsumer()55 build_worker = LoggingConsumer()
50 result_worker = LoggingConsumer()56 result_worker = LoggingConsumer()
51 config = read_config()57 config = read_config()
@@ -56,6 +62,13 @@
56 build_worker.messages_seen[0].get('test_name'), 'snappy-selftest')62 build_worker.messages_seen[0].get('test_name'), 'snappy-selftest')
57 self.assertEqual(63 self.assertEqual(
58 result_worker.messages_seen[0].get('test_name'), 'snappy-selftest')64 result_worker.messages_seen[0].get('test_name'), 'snappy-selftest')
65 # 'image_binaries' payload contains a list of binaries produced
66 # by the source candidate and mentioned on the image manifest. It
67 # should be zipped with the 'source_version' to ensure the correct
68 # binaries are installed in the testing 'rootfs'.
69 self.assertEqual(
70 ['foo', 'bar'],
71 build_worker.messages_seen[0].get('image_binaries'))
5972
6073
61class LoggingConsumer(object):74class LoggingConsumer(object):
6275
=== modified file 'snappy_proposed_selftest_agent/worker.py'
--- snappy_proposed_selftest_agent/worker.py 2015-05-29 02:07:03 +0000
+++ snappy_proposed_selftest_agent/worker.py 2015-05-29 13:41:36 +0000
@@ -62,30 +62,29 @@
62 extra=constants.LOGGING_EXTRA)62 extra=constants.LOGGING_EXTRA)
63 return None63 return None
6464
65 def check_package(self, body):65 def get_manifest_binaries(self, binaries, series, arch):
66 """Check if we need to handle this package or not."""66 """Yields binary names mentioned in the corresponding manifest."""
6767 manifest = self._fetch_manifest(series, arch)
68 release = constants.RELEASE_MAP[constants.RELEASE]68 for binary in binaries:
69 source_series = body['series']69 if binary in manifest:
70 source_name = body['source_name']70 yield binary
71 arch = constants.ARCH
72
73 if source_series != release:
74 # This is not the series we are looking for
75 return False
76
77 manifest = self._fetch_manifest(release, arch)
78 if source_name in manifest:
79 # This package is one we need to test
80 return True
81 else:
82 return False
8371
84 def process(self, body, message):72 def process(self, body, message):
85 """ Process incoming messages about candidate packages """73 """ Process incoming messages about candidate packages """
74 # Dismiss if it's not the series (derived from ubuntu 'release')
75 # this agent cares about.
76 context_series = constants.RELEASE_MAP[constants.RELEASE]
77 if context_series != body['series']:
78 message.ack()
79 return
8680
87 if not self.check_package(body):81 # If no binaries produced by the source candidate are mentioned
88 # If we don't have this package in our channel/image, just exit82 # in the image manifest, it does not need testing.
83 image_binaries = list(
84 self.get_manifest_binaries(
85 body['source_binaries'], context_series, constants.ARCH)
86 )
87 if not image_binaries:
89 message.ack()88 message.ack()
90 return89 return
9190
@@ -101,6 +100,7 @@
101 'channel': constants.CHANNEL,100 'channel': constants.CHANNEL,
102 'release': constants.RELEASE,101 'release': constants.RELEASE,
103 'device': constants.DEVICE,102 'device': constants.DEVICE,
103 'image_binaries': image_binaries,
104 'test_name': constants.TEST_NAME,104 'test_name': constants.TEST_NAME,
105 'test_status': 'RUNNING',105 'test_status': 'RUNNING',
106 # XXX cprov 20150528: this context can't possibly set the106 # XXX cprov 20150528: this context can't possibly set the

Subscribers

People subscribed via source and target branches