Merge lp:~cjohnston/ubuntu-ci-services-itself/failure-is-an-option into lp:ubuntu-ci-services-itself

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 113
Merged at revision: 127
Proposed branch: lp:~cjohnston/ubuntu-ci-services-itself/failure-is-an-option
Merge into: lp:ubuntu-ci-services-itself
Diff against target: 69 lines (+19/-4)
3 files modified
ticket_system/ticket/api.py (+1/-0)
ticket_system/ticket/models.py (+5/-4)
ticket_system/ticket/tests/test_full_read_api.py (+13/-0)
To merge this branch: bzr merge lp:~cjohnston/ubuntu-ci-services-itself/failure-is-an-option
Reviewer Review Type Date Requested Status
Chris Johnston (community) Approve
Ursula Junque (community) Approve
Review via email: mp+201956@code.launchpad.net

Commit message

Add a failure option to tickets

Description of the change

In order to properly display the next ticket API, we need to have a way to mark a ticket as failed and not completed. This change allows a ticket to be marked as failed and updates the status's to explain where it failed to help the WebUI

To post a comment you must log in.
Revision history for this message
Ursula Junque (ursinha) wrote :

After a brief discussion on the test scenario, looks good to me.

review: Approve
Revision history for this message
Chris Johnston (cjohnston) wrote :

 merge approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ticket_system/ticket/api.py'
2--- ticket_system/ticket/api.py 2014-01-16 15:41:39 +0000
3+++ ticket_system/ticket/api.py 2014-01-16 16:05:07 +0000
4@@ -174,6 +174,7 @@
5
6 def get_object_list(self, request):
7 exclude = [TicketWorkflowStep.NEW.value,
8+ TicketWorkflowStep.FAILED.value,
9 TicketWorkflowStep.COMPLETED.value]
10 in_progress = [TicketWorkflowStep.PKG_BUILDING.value,
11 TicketWorkflowStep.IMAGE_BUILDING.value,
12
13=== modified file 'ticket_system/ticket/models.py'
14--- ticket_system/ticket/models.py 2014-01-09 21:06:39 +0000
15+++ ticket_system/ticket/models.py 2014-01-16 16:05:07 +0000
16@@ -49,6 +49,7 @@
17 IMAGE_BUILDING = Item(300, "Image building")
18 IMAGE_TESTING = Item(400, "Image testing")
19 PKG_PUBLISHING = Item(500, "Package publishing")
20+ FAILED = Item(999, "Failed")
21 COMPLETED = Item(1000, "Completed")
22
23
24@@ -59,17 +60,17 @@
25 PKG_BUILDING_WAITING = Item(210, "Not started")
26 PKG_BUILDING_INPROGRESS = Item(220, "In progress")
27 PKG_BUILDING_COMPLETED = Item(230, "Completed")
28- PKG_BUILDING_FAILED = Item(240, "Failed")
29+ PKG_BUILDING_FAILED = Item(240, "Package Building Failed")
30 IMAGE_BUILDING_WAITING = Item(310, "Not started")
31 IMAGE_BUILDING_INPROGRESS = Item(320, "In progress")
32 IMAGE_BUILDING_COMPLETED = Item(330, "Completed")
33- IMAGE_BUILDING_FAILED = Item(340, "Failed")
34+ IMAGE_BUILDING_FAILED = Item(340, "Image Building Failed")
35 IMAGE_TESTING_WAITING = Item(410, "Not started")
36 IMAGE_TESTING_INPROGRESS = Item(420, "In progress")
37 IMAGE_TESTING_PASSED = Item(430, "Passed")
38- IMAGE_TESTING_FAILED = Item(440, "Failed")
39+ IMAGE_TESTING_FAILED = Item(440, "Image Testing Failed")
40 PKG_PUBLISHING_COMPLETED = Item(510, "Completed")
41- PKG_PUBLISHING_FAILED = Item(520, "Failed")
42+ PKG_PUBLISHING_FAILED = Item(520, "Package Publishing Failed")
43 COMPLETED = Item(1000, "Completed")
44
45
46
47=== modified file 'ticket_system/ticket/tests/test_full_read_api.py'
48--- ticket_system/ticket/tests/test_full_read_api.py 2014-01-15 21:05:00 +0000
49+++ ticket_system/ticket/tests/test_full_read_api.py 2014-01-16 16:05:07 +0000
50@@ -231,6 +231,19 @@
51 obj['objects'][0][u'current_workflow_step'], get_enum_title(
52 self.ticket_2.current_workflow_step, TicketWorkflowStep))
53
54+ def test_ticket_failed_next_new_ticket_next(self):
55+ self.ticket_3.current_workflow_step = int(
56+ TicketWorkflowStep.FAILED)
57+ self.ticket_3.save()
58+ obj = self.getResource('next/')
59+ self.assertEqual(len(obj['objects']), 1)
60+ self.assertEqual(obj['objects'][0][u'resource_uri'],
61+ u'/api/v1/next/{0}/'.format(
62+ self.ticket_2.pk))
63+ self.assertEqual(
64+ obj['objects'][0][u'current_workflow_step'], get_enum_title(
65+ self.ticket_2.current_workflow_step, TicketWorkflowStep))
66+
67 def test_no_queued_or_in_progress_ticket_next(self):
68 self.ticket_2.current_workflow_step = int(
69 TicketWorkflowStep.NEW)

Subscribers

People subscribed via source and target branches