Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(smoke): support a per-runner test exclusion list #14316

Merged
merged 13 commits into from
Aug 29, 2022
10 changes: 1 addition & 9 deletions .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,7 @@ jobs:
- run: mkdir latest-run
working-directory: ${{ github.workspace }}/lighthouse
- name: yarn smoke --runner devtools
# Disabled because normal Chrome usage makes DevTools not function on these poorly constructed pages
# errors-expired-ssl, errors-infinite-loop, dbw (dialog prompt)
# Disabled because Chrome will follow the redirect first, and Lighthouse will only ever see/run the final URL.
# redirects-client-paint-server, redirects-multiple-server, redirects-single-server, redirects-single-client
# Disabled because these tests use settings that cannot be fully configured in DevTools (e.g. throttling method "provided").
# metrics-tricky-tti, metrics-tricky-tti-late-fcp, screenshot
# Disabled because of differences that need further investigation
# byte-efficiency, byte-gzip, perf-preload
run: xvfb-run --auto-servernum yarn smoke --runner devtools --shard=${{ matrix.smoke-test-shard }}/${{ strategy.job-total }} --jobs=3 --retries=2 --invert-match byte-efficiency byte-gzip dbw errors-expired-ssl errors-infinite-loop metrics-tricky-tti metrics-tricky-tti-late-fcp perf-preload redirects-client-paint-server redirects-history-push-state redirects-multiple-server redirects-single-server redirects-single-client redirects-scripts screenshot
run: xvfb-run --auto-servernum yarn smoke --runner devtools --shard=${{ matrix.smoke-test-shard }}/${{ strategy.job-total }} --jobs=3 --retries=2
working-directory: ${{ github.workspace }}/lighthouse

- name: Upload failures
Expand Down
31 changes: 31 additions & 0 deletions cli/test/smokehouse/config/exclusions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe rename the directory too to not overload config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the end of the world to remember to go remove it from the exclusions list at that point

I added a console line that lists excluded tests when a requested test is mismatched. So in this scenario, it would print:

Smoketests not found for: byte-efficiency
Check test exclusions (byte-efficiency)

This should help reminding the dev running smoke why a test can't be found. If this and the config edit in practice turns out inconvenient, we can add the --ignore-exclusions that @connorjclark initially suggested.

* @license Copyright 2022 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/**
* List of smoke tests excluded per runner. eg: 'cli': ['a11y', 'dbw']
* @type {Record<string, Array<string>>}
*/
const exclusions = {
'bundle': [],
'cli': [],
'devtools': [
// Disabled because normal Chrome usage makes DevTools not function on
// these poorly constructed pages
'errors-expired-ssl', 'errors-infinite-loop', 'dbw' /* dialog prompt */,
// Disabled because Chrome will follow the redirect first, and Lighthouse will
// only ever see/run the final URL.
'redirects-client-paint-server', 'redirects-multiple-server',
'redirects-single-server', 'redirects-single-client',
'redirects-history-push-state', 'redirects-scripts',
// Disabled because these tests use settings that cannot be fully configured in
// DevTools (e.g. throttling method "provided").
'metrics-tricky-tti', 'metrics-tricky-tti-late-fcp', 'screenshot',
// Disabled because of differences that need further investigation
'byte-efficiency', 'byte-gzip', 'perf-preload',
Comment on lines +23 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@connorjclark should we open smoke backlog bugs for these? Both the explicitly needs investigation and if we can switch the metrics off of provided

],
};

export default exclusions;
7 changes: 6 additions & 1 deletion cli/test/smokehouse/frontends/smokehouse-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import log from 'lighthouse-logger';
import {runSmokehouse, getShardedDefinitions} from '../smokehouse.js';
import {updateTestDefnFormat} from './back-compat-util.js';
import {LH_ROOT} from '../../../../root.js';
import exclusions from '../config/exclusions.js';

const coreTestDefnsPath =
path.join(LH_ROOT, 'cli/test/smokehouse/core-tests.js');
Expand Down Expand Up @@ -69,6 +70,7 @@ function getDefinitionsToRun(allTestDefns, requestedIds, {invertMatch}) {
});
if (unmatchedIds.length) {
console.log(log.redify(`Smoketests not found for: ${unmatchedIds.join(' ')}`));
console.log(`Check test exclusions (${requestedIds.join(' ')})\n`);
console.log(usage);
}

Expand Down Expand Up @@ -193,8 +195,11 @@ async function begin() {
const requestedTestIds = argv._;
const {default: rawTestDefns} = await import(url.pathToFileURL(testDefnPath).href);
const allTestDefns = updateTestDefnFormat(rawTestDefns);
const excludedTests = new Set(exclusions[argv.runner] || []);
const filteredTestDefns = allTestDefns.filter(test => !excludedTests.has(test.id));
const invertMatch = argv.invertMatch;
const requestedTestDefns = getDefinitionsToRun(allTestDefns, requestedTestIds, {invertMatch});
const requestedTestDefns = getDefinitionsToRun(filteredTestDefns,
requestedTestIds, {invertMatch});
const testDefns = getShardedDefinitions(requestedTestDefns, argv.shard);

let smokehouseResult;
Expand Down