Merge lp:~thomir-deactivatedaccount/core-image-watcher/trunk-use-request-id into lp:core-image-watcher

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 17
Merged at revision: 16
Proposed branch: lp:~thomir-deactivatedaccount/core-image-watcher/trunk-use-request-id
Merge into: lp:core-image-watcher
Diff against target: 57 lines (+18/-4)
2 files modified
core_image_watcher/__init__.py (+2/-0)
core_image_watcher/tests/test_image_watcher.py (+16/-4)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/core-image-watcher/trunk-use-request-id
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+255451@code.launchpad.net

Commit message

Add the request_id payload key.

Description of the change

Create and return a uuid in the request payload.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Let's use the kombu UUIDv4 accessor for peace of mind here.

I will pre-approved it because I probably won't be here when you come from lunch.

review: Approve
17. By Thomi Richards

Use kombu uuid.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core_image_watcher/__init__.py'
2--- core_image_watcher/__init__.py 2015-04-03 02:05:16 +0000
3+++ core_image_watcher/__init__.py 2015-04-08 01:59:17 +0000
4@@ -25,6 +25,7 @@
5 import time
6
7 import kombu
8+from kombu.common import uuid
9 from uservice_utils.logging import configure_service_logging
10
11 from core_image_watcher import constants
12@@ -128,6 +129,7 @@
13 'image_name': latest_version,
14 'channel': channel,
15 'device': device,
16+ 'request_id': uuid(),
17 }
18 return body
19
20
21=== modified file 'core_image_watcher/tests/test_image_watcher.py'
22--- core_image_watcher/tests/test_image_watcher.py 2015-03-26 20:44:05 +0000
23+++ core_image_watcher/tests/test_image_watcher.py 2015-04-08 01:59:17 +0000
24@@ -16,6 +16,11 @@
25 import os
26 import tempfile
27 import testtools
28+from testtools.matchers import (
29+ Equals,
30+ MatchesDict,
31+ NotEquals,
32+)
33
34 from core_image_watcher import (
35 _cache_version_to_disk,
36@@ -90,10 +95,17 @@
37 'fakedevice',
38 _get_latest_image_version,
39 _cache_version_to_disk)
40- self.assertEqual(body,
41- {'device': 'fakedevice',
42- 'image_name': '100',
43- 'channel': 'fakechannel'})
44+ self.assertThat(
45+ body,
46+ MatchesDict(
47+ {
48+ 'device': Equals('fakedevice'),
49+ 'image_name': Equals('100'),
50+ 'channel': Equals('fakechannel'),
51+ 'request_id': NotEquals(''),
52+ }
53+ )
54+ )
55
56 def test_check_for_no_new_image(self):
57 def _get_latest_image_version(channel, device):

Subscribers

People subscribed via source and target branches

to all changes: