Add structured test id upload support to resuldb uploader

Not sure how to roll this to src after landing.
This is similar to changes for structured-test-ids in changes such as:
https://source.chromium.org/chromium/chromium/src/+/main:testing/scripts/common.py;l=203?q=common.py&ss=chromium

Bug:418015486
Change-Id: I742a6a9e7b04735e31aa1b893a1cbffc9d6e3188
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7173696
Commit-Queue: Benjamin Joyce (Ben) <bjoyce@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
This commit is contained in:
Ben Joyce
2025-12-02 14:08:33 -08:00
committed by LUCI CQ
parent 115fbc83d3
commit a99ce048b9
2 changed files with 18 additions and 1 deletions

View File

@@ -76,6 +76,12 @@ class TestClient(unittest.TestCase):
class TestResultSink(unittest.TestCase):
struct_test_dict = {
'coarseName': None,
'fineName': None,
'caseNameComponents': ['function_foo'],
}
def test_report(self):
session = mock.MagicMock()
sink = rdb_wrapper.ResultSink(session, 'http://host', 'test_id_prefix/')
@@ -85,6 +91,7 @@ class TestResultSink(unittest.TestCase):
'status': rdb_wrapper.STATUS_PASS,
'expected': True,
'duration': '123.000000000s',
'testIdStructured': TestResultSink.struct_test_dict,
}
session.post.assert_called_once_with(
'http://host',
@@ -100,6 +107,7 @@ class TestResultSink(unittest.TestCase):
'status': rdb_wrapper.STATUS_PASS,
'expected': True,
'duration': '123.000000000s',
'testIdStructured': TestResultSink.struct_test_dict,
'failureReason': {
'primaryErrorMessage': 'Bad CL.',
},
@@ -121,6 +129,7 @@ class TestResultSink(unittest.TestCase):
'status': rdb_wrapper.STATUS_PASS,
'expected': True,
'duration': '123.000000000s',
'testIdStructured': TestResultSink.struct_test_dict,
'failureReason': {
'primaryErrorMessage': expected_truncated_error,
},