Skip to content

Commit 9de7b35

Browse files
Write new summaries as "_v2" (#2939)
* write summaries with "_v2" suffix * update comment and regex * fix logic * add a test with new summary url format * add _v2 to tests * add resultsURL tests * style fix * test and style fix
1 parent 3f36cb0 commit 9de7b35

File tree

8 files changed

+42
-12
lines changed

8 files changed

+42
-12
lines changed

results-processor/processor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ def upload_split(self):
204204
"""Uploads the individual results recursively to GCS."""
205205
self.report.populate_upload_directory(output_dir=self._upload_dir)
206206

207-
# 1. Copy [ID]-summary.json.gz to gs://wptd/[SHA]/[ID]-summary.json.gz.
207+
# 1. Copy [ID]-summary_v2.json.gz
208+
# to gs://wptd/[SHA]/[ID]-summary_v2.json.gz.
208209
gsutil.copy(
209210
os.path.join(self._upload_dir, self.report.sha_summary_path),
210211
self.results_gs_url,

results-processor/wptreport.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def populate_upload_directory(self,
415415
The directory structure is as follows:
416416
[output_dir]:
417417
- [sha][:10]:
418-
- [product]-summary.json.gz
418+
- [product]-summary_v2.json.gz
419419
- [product]:
420420
- (per-test results produced by write_result_directory)
421421
@@ -445,8 +445,8 @@ def sha_product_path(self) -> str:
445445

446446
@property
447447
def sha_summary_path(self) -> str:
448-
"""A relative path: sha/product_id-summary.json.gz"""
449-
return self.sha_product_path + '-summary.json.gz'
448+
"""A relative path: sha/product_id-summary_v2.json.gz"""
449+
return self.sha_product_path + '-summary_v2.json.gz'
450450

451451
@property
452452
def test_run_metadata(self) -> Dict[str, str]:
@@ -635,7 +635,7 @@ def create_test_run(report, run_id, labels_str, uploader, auth,
635635
uploader: The name of the uploader.
636636
auth: A (username, password) tuple for HTTP basic auth.
637637
results_url: URL of the gzipped summary file. (e.g.
638-
'https://.../wptd/0123456789/chrome-62.0-linux-summary.json.gz')
638+
'https://.../wptd/0123456789/chrome-62.0-linux-summary_v2.json.gz')
639639
raw_results_url: URL of the raw full report. (e.g.
640640
'https://.../wptd-results/[FullSHA]/chrome-62.0-linux/report.json')
641641

results-processor/wptreport_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def test_populate_upload_directory(self):
392392

393393
self.assertTrue(os.path.isfile(os.path.join(
394394
self.tmp_dir, revision,
395-
'firefox-59.0-linux-0123456789-summary.json.gz'
395+
'firefox-59.0-linux-0123456789-summary_v2.json.gz'
396396
)))
397397
self.assertTrue(os.path.isfile(os.path.join(
398398
self.tmp_dir, revision,
@@ -530,7 +530,7 @@ def test_sha_summary_path(self):
530530
r.hashsum = lambda: 'afa59408e1797c7091d7e89de5561612f7da440d'
531531
self.assertEqual(r.sha_summary_path,
532532
'0bdaaf9c1622ca49eb140381af1ece6d8001c934/'
533-
'firefox-59.0-linux-afa59408e1-summary.json.gz')
533+
'firefox-59.0-linux-afa59408e1-summary_v2.json.gz')
534534

535535
def test_normalize_version(self):
536536
r = WPTReport()

shared/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func GetResultsURL(run TestRun, testFile string) (resultsURL string) {
144144
// Assumes that result files are under a directory named SHA[0:10].
145145
resultsBase := strings.SplitAfter(resultsURL, "/"+run.Revision)[0]
146146
resultsPieces := strings.Split(resultsURL, "/")
147-
re := regexp.MustCompile("(-summary)?\\.json\\.gz$")
147+
re := regexp.MustCompile("(-summary(_v2)?)?\\.json\\.gz$")
148148
product := re.ReplaceAllString(resultsPieces[len(resultsPieces)-1], "")
149149
resultsURL = fmt.Sprintf("%s/%s/%s", resultsBase, product, testFile)
150150
}

shared/util_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const shortSHA = "abcdef0123"
1616
const resultsURLBase = "https://storage.googleapis.com/wptd/" + shortSHA + "/"
1717
const product = "chrome-63.0-linux"
1818
const resultsURL = resultsURLBase + "/" + product + "-summary.json.gz"
19+
const resultsURLNewFormat = resultsURLBase + "/" + product + "-summary_v2.json.gz"
1920

2021
func TestMapStringKeys(t *testing.T) {
2122
m := map[string]int{"foo": 1}
@@ -64,6 +65,12 @@ func TestGetResultsURL_EmptyFile(t *testing.T) {
6465
checkResult(t, run, "", resultsURL)
6566
}
6667

68+
func TestGetResultsURL_NewSummaryFormat(t *testing.T) {
69+
run := TestRun{ResultsURL: resultsURLNewFormat}
70+
run.Revision = shortSHA
71+
checkResult(t, run, "", resultsURLNewFormat)
72+
}
73+
6774
func TestGetResultsURL_TestFile(t *testing.T) {
6875
run := TestRun{ResultsURL: resultsURL}
6976
run.Revision = shortSHA

webapp/components/test-file-results.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,13 @@ class TestFileResults extends WPTFlags(LoadingState(PathInfo(
270270

271271
resultsURL(testRun, path) {
272272
path = this.encodeTestPath(path);
273-
// This is relying on the assumption that result files end with '-summary.json.gz'.
274-
const resultsBase = testRun.results_url.slice(0, testRun.results_url.lastIndexOf('-summary.json.gz'));
273+
// This is relying on the assumption that result
274+
// files end with '-summary.json.gz' or '-summary_v2.json.gz'.
275+
let resultsSuffix = '-summary.json.gz';
276+
if (!testRun.results_url.includes(resultsSuffix)) {
277+
resultsSuffix = '-summary_v2.json.gz';
278+
}
279+
const resultsBase = testRun.results_url.slice(0, testRun.results_url.lastIndexOf(resultsSuffix));
275280
return `${resultsBase}${path}`;
276281
}
277282

webapp/components/test/test-file-results.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@
4242
});
4343
});
4444

45+
suite('resultsURL', () => {
46+
test('v1 url', () => {
47+
expect(
48+
tfr.resultsURL(
49+
TEST_RUNS_DATA[1],
50+
'/example/test/path'
51+
)).to.equal('https://storage.googleapis.com/wptd/03d67ae5d9/edge-15-windows-10-sauce/example/test/path');
52+
});
53+
test('v2 url', () => {
54+
expect(
55+
tfr.resultsURL(
56+
TEST_RUNS_DATA[0],
57+
'/example/test/path'
58+
)).to.equal('https://storage.googleapis.com/wptd/53c5bf648c/chrome-63.0-linux/example/test/path');
59+
});
60+
});
61+
4562
suite('TestFileResults.prototype.*', () => {
4663
suite('statusName', () => {
4764
test('no subtests', () => {

webapp/components/test/util/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const TEST_RUNS_DATA = [
2323
os_name: 'linux',
2424
os_version: '*',
2525
revision: '53c5bf648c',
26-
results_url: 'https://storage.googleapis.com/wptd/53c5bf648c/chrome-63.0-linux-summary.json.gz',
26+
results_url: 'https://storage.googleapis.com/wptd/53c5bf648c/chrome-63.0-linux-summary_v2.json.gz',
2727
created_at: '2018-01-09T15:47:03.949Z',
2828
},
2929
{
@@ -43,7 +43,7 @@ const TEST_RUNS_DATA = [
4343
os_name: 'linux',
4444
os_version: '*',
4545
revision: '1f9c924a4b',
46-
results_url: 'https://storage.googleapis.com/wptd/1f9c924a4b/firefox-57.0-linux-summary.json.gz',
46+
results_url: 'https://storage.googleapis.com/wptd/1f9c924a4b/firefox-57.0-linux-summary_v2.json.gz',
4747
created_at: '2018-01-09T15:54:04.296Z',
4848
},
4949
{

0 commit comments

Comments
 (0)