From c9a16c40edbd859cfd7c77bc951ce48b143a6619 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Thu, 18 Jun 2020 03:59:54 +0000 Subject: [PATCH] Bug 1631806 - [part 1] Update perftests to use new API and fix `--proxy` option; r=tarek This patch fixes the tests in testing/performance/ that hadn't been updated to the new API, as well as fixing a couple issues with the `--proxy` option: * `policy.json` wasn't being logged correctly, since mozlog was treating the data as a format string * Proxy prefs weren't being set correctly for the profile Differential Revision: https://phabricator.services.mozilla.com/D79937 --- python/mozperftest/mozperftest/system/proxy.py | 6 +----- testing/performance/perftest_bbc_link.js | 9 ++++++++- testing/performance/perftest_facebook.js | 9 ++++++++- testing/performance/perftest_jsconf_cold.js | 9 ++++++++- testing/performance/perftest_jsconf_warm.js | 9 ++++++++- testing/performance/perftest_politico_link.js | 9 ++++++++- testing/performance/perftest_youtube_link.js | 9 ++++++++- 7 files changed, 49 insertions(+), 11 deletions(-) diff --git a/python/mozperftest/mozperftest/system/proxy.py b/python/mozperftest/mozperftest/system/proxy.py index a2c42affdaf6..58c841159f07 100644 --- a/python/mozperftest/mozperftest/system/proxy.py +++ b/python/mozperftest/mozperftest/system/proxy.py @@ -55,11 +55,7 @@ class ProxyRunner(Layer): prefs["network.proxy.ssl_port"] = port prefs["network.proxy.no_proxies_on"] = "localhost" browser_prefs = metadata.get_options("browser_prefs") - if "prefs" in browser_prefs: - browser_prefs["prefs"].update(prefs) - else: - browser_prefs["prefs"] = prefs - metadata.update_options("browser_prefs", browser_prefs) + browser_prefs.update(prefs) return metadata diff --git a/testing/performance/perftest_bbc_link.js b/testing/performance/perftest_bbc_link.js index 3263195cfa0d..7bf1ce2ffd66 100644 --- a/testing/performance/perftest_bbc_link.js +++ b/testing/performance/perftest_bbc_link.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { let rootUrl = "https://www.bbc.com/"; await commands.navigate(rootUrl); @@ -14,4 +14,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "BBC Link", + description: "Measures time to load BBC homepage", }; diff --git a/testing/performance/perftest_facebook.js b/testing/performance/perftest_facebook.js index 4325b4388834..3455d7abb0b2 100644 --- a/testing/performance/perftest_facebook.js +++ b/testing/performance/perftest_facebook.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { await commands.navigate("https://www.example.com"); await commands.wait.byTime(15000); @@ -37,4 +37,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement before the next page we want to measure await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "Facebook", + description: "Measures time to log in to Facebook", }; diff --git a/testing/performance/perftest_jsconf_cold.js b/testing/performance/perftest_jsconf_cold.js index 5e0794b7105b..f68a3d03b682 100644 --- a/testing/performance/perftest_jsconf_cold.js +++ b/testing/performance/perftest_jsconf_cold.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { let rootUrl = "https://2019.jsconf.eu/"; await commands.navigate(rootUrl); @@ -14,4 +14,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "JSConf (cold)", + description: "Measures time to load JSConf page (cold)", }; diff --git a/testing/performance/perftest_jsconf_warm.js b/testing/performance/perftest_jsconf_warm.js index 002b5fb6d1b2..43d8395e0be2 100644 --- a/testing/performance/perftest_jsconf_warm.js +++ b/testing/performance/perftest_jsconf_warm.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { let rootUrl = "https://2019.jsconf.eu/"; await commands.navigate(rootUrl); @@ -20,4 +20,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "JSConf (warm)", + description: "Measures time to load JSConf page (warm)", }; diff --git a/testing/performance/perftest_politico_link.js b/testing/performance/perftest_politico_link.js index fc06bc1609ca..c327d6734712 100644 --- a/testing/performance/perftest_politico_link.js +++ b/testing/performance/perftest_politico_link.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { let rootUrl = "https://www.politico.com/"; await commands.navigate(rootUrl); @@ -14,4 +14,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "Politico Link", + description: "Measures time to load Politico homepage", }; diff --git a/testing/performance/perftest_youtube_link.js b/testing/performance/perftest_youtube_link.js index fc06bc1609ca..5af72c670fed 100644 --- a/testing/performance/perftest_youtube_link.js +++ b/testing/performance/perftest_youtube_link.js @@ -1,4 +1,4 @@ -module.exports = async function(context, commands) { +async function test(context, commands) { let rootUrl = "https://www.politico.com/"; await commands.navigate(rootUrl); @@ -14,4 +14,11 @@ module.exports = async function(context, commands) { // Stop and collect the measurement await commands.measure.stop(); +} + +module.exports = { + test, + owner: "Performance Team", + name: "YouTube Link", + description: "Measures time to load YouTube video", };