Renamed variable to something more illuminating.
The variable storing start time of playbook run was named 't0'. While perfecly fine from a functional standpoint, and also in statistics and physics with subscript, it is nonetheless a bit hard on the eye. Tests were adjusted to reflect new var name. Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: Ie0796b1dcb8beacc08755fa04ff3cd4dd884ef59
This commit is contained in:
parent
4b87cf203b
commit
2e3e7f3f2b
@ -68,7 +68,7 @@ class CallbackModule(CallbackBase):
|
|||||||
self.results = []
|
self.results = []
|
||||||
self.simple_results = []
|
self.simple_results = []
|
||||||
self.env = {}
|
self.env = {}
|
||||||
self.t0 = None
|
self.start_time = None
|
||||||
self.current_time = current_time()
|
self.current_time = current_time()
|
||||||
|
|
||||||
def _new_play(self, play):
|
def _new_play(self, play):
|
||||||
@ -115,7 +115,7 @@ class CallbackModule(CallbackBase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def v2_playbook_on_start(self, playbook):
|
def v2_playbook_on_start(self, playbook):
|
||||||
self.t0 = time.time()
|
self.start_time = time.time()
|
||||||
pl = playbook._file_name
|
pl = playbook._file_name
|
||||||
validation_id = os.path.splitext(os.path.basename(pl))[0]
|
validation_id = os.path.splitext(os.path.basename(pl))[0]
|
||||||
self.env = {
|
self.env = {
|
||||||
@ -181,7 +181,7 @@ class CallbackModule(CallbackBase):
|
|||||||
self.simple_results[-1]['task']['hosts'][host.name] = task_result
|
self.simple_results[-1]['task']['hosts'][host.name] = task_result
|
||||||
|
|
||||||
end_time = current_time()
|
end_time = current_time()
|
||||||
time_elapsed = secondsToStr(time.time() - self.t0)
|
time_elapsed = secondsToStr(time.time() - self.start_time)
|
||||||
for result in self.results:
|
for result in self.results:
|
||||||
if len(result['tasks']) > 1:
|
if len(result['tasks']) > 1:
|
||||||
result['tasks'][-1]['task']['duration']['end'] = end_time
|
result['tasks'][-1]['task']['duration']['end'] = end_time
|
||||||
|
@ -52,7 +52,7 @@ class CallbackModule(CallbackBase):
|
|||||||
def __init__(self, display=None):
|
def __init__(self, display=None):
|
||||||
super(CallbackModule, self).__init__(display)
|
super(CallbackModule, self).__init__(display)
|
||||||
self.env = {}
|
self.env = {}
|
||||||
self.t0 = None
|
self.start_time = None
|
||||||
self.current_time = current_time()
|
self.current_time = current_time()
|
||||||
|
|
||||||
def _new_play(self, play):
|
def _new_play(self, play):
|
||||||
|
@ -90,7 +90,7 @@ class TestValidationJson(base.TestCase):
|
|||||||
self.assertEqual(callback.results, [])
|
self.assertEqual(callback.results, [])
|
||||||
self.assertEqual(callback.simple_results, [])
|
self.assertEqual(callback.simple_results, [])
|
||||||
self.assertEqual(callback.env, {})
|
self.assertEqual(callback.env, {})
|
||||||
self.assertIsNone(callback.t0)
|
self.assertIsNone(callback.start_time)
|
||||||
"""
|
"""
|
||||||
Callback time sanity check only verifies general format
|
Callback time sanity check only verifies general format
|
||||||
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
||||||
@ -396,7 +396,7 @@ class TestValidationJson(base.TestCase):
|
|||||||
callback = validation_json.CallbackModule()
|
callback = validation_json.CallbackModule()
|
||||||
callback.results = callback_results
|
callback.results = callback_results
|
||||||
callback.simple_results = callback_simple_results
|
callback.simple_results = callback_simple_results
|
||||||
callback.t0 = 0
|
callback.start_time = 0
|
||||||
|
|
||||||
callback._record_task_result(mock_on_info, mock_result)
|
callback._record_task_result(mock_on_info, mock_result)
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class TestValidationStdout(base.TestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self.assertEqual(callback.env, {})
|
self.assertEqual(callback.env, {})
|
||||||
self.assertIsNone(callback.t0)
|
self.assertIsNone(callback.start_time)
|
||||||
"""
|
"""
|
||||||
Callback time sanity check only verifies general format
|
Callback time sanity check only verifies general format
|
||||||
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
||||||
|
Loading…
Reference in New Issue
Block a user