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:
Jiri Podivin 2021-01-25 09:45:17 +01:00
parent 4b87cf203b
commit 2e3e7f3f2b
4 changed files with 7 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class CallbackModule(CallbackBase):
self.results = []
self.simple_results = []
self.env = {}
self.t0 = None
self.start_time = None
self.current_time = current_time()
def _new_play(self, play):
@ -115,7 +115,7 @@ class CallbackModule(CallbackBase):
}
def v2_playbook_on_start(self, playbook):
self.t0 = time.time()
self.start_time = time.time()
pl = playbook._file_name
validation_id = os.path.splitext(os.path.basename(pl))[0]
self.env = {
@ -181,7 +181,7 @@ class CallbackModule(CallbackBase):
self.simple_results[-1]['task']['hosts'][host.name] = task_result
end_time = current_time()
time_elapsed = secondsToStr(time.time() - self.t0)
time_elapsed = secondsToStr(time.time() - self.start_time)
for result in self.results:
if len(result['tasks']) > 1:
result['tasks'][-1]['task']['duration']['end'] = end_time

View File

@ -52,7 +52,7 @@ class CallbackModule(CallbackBase):
def __init__(self, display=None):
super(CallbackModule, self).__init__(display)
self.env = {}
self.t0 = None
self.start_time = None
self.current_time = current_time()
def _new_play(self, play):

View File

@ -90,7 +90,7 @@ class TestValidationJson(base.TestCase):
self.assertEqual(callback.results, [])
self.assertEqual(callback.simple_results, [])
self.assertEqual(callback.env, {})
self.assertIsNone(callback.t0)
self.assertIsNone(callback.start_time)
"""
Callback time sanity check only verifies general format
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.results = callback_results
callback.simple_results = callback_simple_results
callback.t0 = 0
callback.start_time = 0
callback._record_task_result(mock_on_info, mock_result)

View File

@ -91,7 +91,7 @@ class TestValidationStdout(base.TestCase):
"""
self.assertEqual(callback.env, {})
self.assertIsNone(callback.t0)
self.assertIsNone(callback.start_time)
"""
Callback time sanity check only verifies general format
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`