Skip to content

Commit

Permalink
Add a flag to indicate processing time calculation may be incorrect i…
Browse files Browse the repository at this point in the history
…f an advisory is not associated with a build
  • Loading branch information
sarah256 committed Aug 20, 2019
1 parent 411840b commit 98938b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions estuary/utils/story.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def get_total_processing_time(self, results):
'encountered without a build or creation time.',
artifact.__label__, getattr(artifact,
artifact.unique_id_property + '_'))
flag = True
continue

# We do not want the processing time of the entire FreshmakerEvent, just the
Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_story.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ def test_get_stories_just_artifact(client):
'story_type': 'container',
'total_lead_time': 0,
'total_processing_time': 0,
'processing_time_flag': False,
'processing_time_flag': True,
'total_wait_time': 0,
'wait_times': [0]
}
Expand Down Expand Up @@ -1930,7 +1930,7 @@ def test_get_story_partial_story(client):
'story_type': 'container',
'total_lead_time': 2642400.0,
'total_processing_time': 1605600.0,
'processing_time_flag': False,
'processing_time_flag': True,
'total_wait_time': 1036800.0,
'wait_times': [1036800.0, 50400.0]
}
Expand Down
16 changes: 8 additions & 8 deletions tests/api/test_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,39 +113,39 @@ def test_full_module_timeline():
('BugzillaBug', {
'id_': '1111',
'creation_time': datetime(2019, 1, 1, 0, 0, 0)
}, [0, 0, [0], 0]),
}, [0, 0, [0], 0, False]),
('DistGitCommit', {
'hash_': '2222',
'commit_date': datetime(2019, 1, 1, 0, 0, 10)
}, [0, 0, [0], 0]),
}, [0, 0, [0], 0, False]),
('KojiBuild', {
'id_': '3333',
'creation_time': datetime(2019, 1, 1, 0, 0, 20),
'completion_time': datetime(2019, 1, 1, 0, 0, 30)
}, [10.0, 10.0, [0], 0]),
}, [10.0, 10.0, [0], 0, False]),
('Advisory', {
'id_': '4444',
'state': 'SHIPPED_LIVE',
'created_at': datetime(2019, 1, 1, 0, 0, 40),
'status_time': datetime(2019, 1, 1, 0, 0, 50)
}, [0, 10.0, [0], 0]),
}, [0, 10.0, [0], 0, True]),
('FreshmakerEvent', {
'id_': '5555',
'time_created': datetime(2019, 1, 1, 0, 1, 0),
'time_done': datetime(2019, 1, 1, 0, 1, 10),
'state_name': 'COMPLETE'
}, [10.0, 10.0, [0], 0]),
}, [10.0, 10.0, [0], 0, False]),
('ContainerKojiBuild', {
'id_': '6666',
'creation_time': datetime(2019, 1, 1, 0, 1, 20),
'completion_time': datetime(2019, 1, 1, 0, 1, 30)
}, [10.0, 10.0, [0], 0]),
}, [10.0, 10.0, [0], 0, False]),
('ContainerAdvisory', {
'id_': '7777',
'state': 'SHIPPED_LIVE',
'created_at': datetime(2019, 1, 1, 0, 1, 40),
'status_time': datetime(2019, 1, 1, 0, 1, 50)
}, [0, 10.0, [0], 0]),
}, [0, 10.0, [0], 0, True]),
])
def test_individual_nodes(label, data, expected):
"""Test the data relating to the timeline with only one node."""
Expand All @@ -156,10 +156,10 @@ def test_individual_nodes(label, data, expected):
wait_times, total_wait_time = base_instance.get_wait_times([artifact])

assert processing_time == expected[0]
assert flag is False
assert lead_time == expected[1]
assert wait_times == expected[2]
assert total_wait_time == expected[3]
assert flag is expected[4]


def test_event_building():
Expand Down

0 comments on commit 98938b3

Please sign in to comment.