Update "evt" field to be logged as a string type.

Testing:
- Unit tests
- Verified git trace log has "evt": "2" (vs "evt": 2 previously)

Bug: https://crbug.com/gerrit/13966
Change-Id: I2e0c98dda0cccdd5cb6328105c11b93cd42676eb
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/294123
Reviewed-by: Jonathan Nieder <jrn@google.com>
Tested-by: Ian Kasprzak <iankaz@google.com>
This commit is contained in:
Ian Kasprzak 2021-01-19 09:04:28 -08:00
parent e5670c8812
commit febe73ff16
2 changed files with 3 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class EventLog(object):
def _AddVersionEvent(self): def _AddVersionEvent(self):
"""Adds a 'version' event at the beginning of current log.""" """Adds a 'version' event at the beginning of current log."""
version_event = self._CreateEventDict('version') version_event = self._CreateEventDict('version')
version_event['evt'] = 2 version_event['evt'] = "2"
version_event['exe'] = RepoSourceVersion() version_event['exe'] = RepoSourceVersion()
self._log.insert(0, version_event) self._log.insert(0, version_event)

View File

@ -95,6 +95,8 @@ class EventLogTestCase(unittest.TestCase):
# Check for 'version' event specific fields. # Check for 'version' event specific fields.
self.assertIn('evt', version_event) self.assertIn('evt', version_event)
self.assertIn('exe', version_event) self.assertIn('exe', version_event)
# Verify "evt" version field is a string.
self.assertIsInstance(version_event['evt'], str)
def test_start_event(self): def test_start_event(self):
"""Test and validate 'start' event data is valid. """Test and validate 'start' event data is valid.