Skip to content

Commit

Permalink
JUnit XML output: Include timezone information in XML
Browse files Browse the repository at this point in the history
JUnit writes local-time without a timezone by default.  This means that
JUnit XML parsers default to local-time.  The portal doesn't know what
timezone the user of stbt-rig wants so these timestamps can be interpreted
incorrectly.  This change includes timezone information in the XML output.

There is a small chance of incompatibilty caused by this change.  If you
experience this please get in contact at support@stb-tester.com.
  • Loading branch information
wmanley committed Sep 4, 2020
1 parent 81bd323 commit 9b01331
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion stbt_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ def list_results(self):

def list_results_xml(self):
r = self.portal._get(
'/api/v2/results.xml', params={'filter': 'job:%s' % self.job_uid})
'/api/v2/results.xml', params={'filter': 'job:%s' % self.job_uid,
'include_tz': 'true'})
r.raise_for_status()
return r.text

Expand Down
3 changes: 2 additions & 1 deletion test_stbt_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def get_results():
@self.app.route('/api/v2/results.xml')
def get_results_xml():
assert flask.request.args['filter'] == 'job:/mynode/6Pfq/167'
assert flask.request.args['include_tz'] == 'true'
return PortalMock.RESULTS_XML

@self.app.route('/api/v2/results/<path:result_id>')
Expand Down Expand Up @@ -276,7 +277,7 @@ def on_run_tests(self, j):
RESULTS_XML = (
'<testsuite disabled="0" errors="0" failures="0" '
'name="test" skipped="0" tests="1" time="3.270815" '
'timestamp="2019-06-12T15:26:35">'
'timestamp="2019-06-12T15:26:35+00:00">'
'<testcase classname="tests/test.py" name="test_my_tests" '
'time="3.270815"/>'
'</testsuite>')
Expand Down

0 comments on commit 9b01331

Please sign in to comment.