Commit e5bcc4f7 authored by Scott Lee's avatar Scott Lee Committed by Commit Bot

[web_tests][resultdb] replace testLocation by testMetadata

testLocation has been moved to testMetadata.
- https://source.chromium.org/chromium/infra/infra/+/master:go/src/go.chromium.org/luci/resultdb/sink/proto/v1/test_result.proto;l=61-66
- https://source.chromium.org/chromium/infra/infra/+/master:go/src/go.chromium.org/luci/resultdb/proto/v1/test_metadata.proto;l=32-50

R=chanli@chromium.org,robertma@chromium.org
CC=nodir@chromium.org

Bug: 1137513
Change-Id: I9ab4cf8a4a5117c7d18cb3eae71a61da59715413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532912
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: default avatarChan Li <chanli@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827315}
parent 72b0af66
...@@ -17,6 +17,7 @@ import json ...@@ -17,6 +17,7 @@ import json
import logging import logging
import requests import requests
from blinkpy.common.path_finder import RELATIVE_WEB_TESTS
from blinkpy.web_tests.models.typ_types import ResultType from blinkpy.web_tests.models.typ_types import ResultType
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
...@@ -165,6 +166,7 @@ class TestResultSink(object): ...@@ -165,6 +166,7 @@ class TestResultSink(object):
# The structure and member definitions of this dict can be found at # The structure and member definitions of this dict can be found at
# https://chromium.googlesource.com/infra/luci/luci-go/+/refs/heads/master/resultdb/proto/sink/v1/test_result.proto # https://chromium.googlesource.com/infra/luci/luci-go/+/refs/heads/master/resultdb/proto/sink/v1/test_result.proto
locFileName = '//%s%s' % (RELATIVE_WEB_TESTS, result.test_name)
r = { r = {
'artifacts': self._artifacts(result), 'artifacts': self._artifacts(result),
'duration': '%ss' % result.total_run_time, 'duration': '%ss' % result.total_run_time,
...@@ -176,13 +178,17 @@ class TestResultSink(object): ...@@ -176,13 +178,17 @@ class TestResultSink(object):
# 'startTime': result.start_time # 'startTime': result.start_time
'tags': self._tags(result), 'tags': self._tags(result),
'testId': result.test_name, 'testId': result.test_name,
'testMetadata': {
# testLocation is where the test is defined. It is used to find 'name': result.test_name,
# the associated component/team/os information in flakiness and
# disabled-test dashboards. # location is where the test is defined. It is used to find
'testLocation': { # the associated component/team/os information in flakiness
'fileName': # and disabled-test dashboards.
'//third_party/blink/web_tests/' + result.test_name, 'location': {
'repo': 'https://chromium.googlesource.com/chromium/src',
'fileName': locFileName,
# skip: 'line'
},
}, },
} }
self._send({'testResults': [r]}) self._send({'testResults': [r]})
......
...@@ -11,6 +11,7 @@ import unittest ...@@ -11,6 +11,7 @@ import unittest
from urlparse import urlparse from urlparse import urlparse
from blinkpy.common.host_mock import MockHost from blinkpy.common.host_mock import MockHost
from blinkpy.common.path_finder import RELATIVE_WEB_TESTS
from blinkpy.web_tests.controllers.test_result_sink import CreateTestResultSink from blinkpy.web_tests.controllers.test_result_sink import CreateTestResultSink
from blinkpy.web_tests.controllers.test_result_sink import TestResultSink from blinkpy.web_tests.controllers.test_result_sink import TestResultSink
from blinkpy.web_tests.models import test_results from blinkpy.web_tests.models import test_results
...@@ -94,15 +95,33 @@ class TestResultSinkMessage(TestResultSinkTestBase): ...@@ -94,15 +95,33 @@ class TestResultSinkMessage(TestResultSinkTestBase):
self.assertEqual(sent_data['status'], 'CRASH') self.assertEqual(sent_data['status'], 'CRASH')
self.assertEqual(sent_data['duration'], '123.456s') self.assertEqual(sent_data['duration'], '123.456s')
def test_test_location(self): def test_test_metadata(self):
tr = test_results.TestResult('') tr = test_results.TestResult('')
prefix = '//third_party/blink/web_tests/' base_path = '//' + RELATIVE_WEB_TESTS
sink = lambda tr: self.sink(True, tr)['testLocation']['fileName']
tr.test_name = "test-name" tr.test_name = "test-name"
self.assertEqual(sink(tr), prefix + 'test-name') self.assertDictEqual(
self.sink(True, tr)['testMetadata'],
{
'name': 'test-name',
'location': {
'repo': 'https://chromium.googlesource.com/chromium/src',
'fileName': base_path + 'test-name',
},
},
)
tr.test_name = "///test-name" tr.test_name = "///test-name"
self.assertEqual(sink(tr), prefix + '///test-name') self.assertDictEqual(
self.sink(True, tr)['testMetadata'],
{
'name': '///test-name',
'location': {
'repo': 'https://chromium.googlesource.com/chromium/src',
'fileName': base_path + '///test-name',
},
},
)
def test_device_failure(self): def test_device_failure(self):
tr = test_results.TestResult(test_name='test-name') tr = test_results.TestResult(test_name='test-name')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment