Skip to content

Commit

Permalink
tests(smoke): drop legacy support (#15249)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Jul 11, 2023
1 parent 5a409fd commit 54830c8
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 246 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/package-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,3 @@ jobs:

# Fail if any changes were written to source files.
- run: git diff --exit-code

package-test-legacy:
runs-on: ubuntu-latest
name: Package Test Legacy Navigation
env:
FORCE_COLOR: true

steps:
- name: git clone
uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- run: yarn install --frozen-lockfile --network-timeout 1000000
- run: yarn build-report
- run: sudo apt-get install xvfb

- run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/core/scripts/release/package-test.sh --legacy-navigation

# Fail if any changes were written to source files.
- run: git diff --exit-code
96 changes: 0 additions & 96 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,54 +120,6 @@ jobs:
name: Smokehouse (windows)
path: .tmp/smokehouse-failures/

smoke-legacy:
strategy:
matrix:
smoke-test-shard: [1, 2, 3]
# e.g. if set 1 fails, continue with set 2 anyway
fail-fast: false
runs-on: ubuntu-latest
env:
# The total number of shards. Set dynamically when length of *single* matrix variable is
# computable. See https://github.community/t/get-length-of-strategy-matrix-or-get-all-matrix-options/18342
SHARD_TOTAL: 3
FORCE_COLOR: true
name: Legacy Navigation ${{ matrix.smoke-test-shard }}/3

steps:
- name: git clone
uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- run: yarn install --frozen-lockfile --network-timeout 1000000
- run: yarn build-report
- run: yarn reset-link

- name: Define ToT chrome path
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV

- name: Install Chrome ToT
working-directory: /home/runner
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot

- run: sudo apt-get install xvfb
- name: yarn smoke --legacy-navigation
run: xvfb-run --auto-servernum yarn smoke --debug --legacy-navigation -j=2 --retries=2 --shard=${{ matrix.smoke-test-shard }}/$SHARD_TOTAL

# Fail if any changes were written to source files.
- run: git diff --exit-code

- name: Upload failures
if: failure()
uses: actions/upload-artifact@v1
with:
name: Smokehouse (legacy)
path: .tmp/smokehouse-failures/

smoke-bundle:
strategy:
matrix:
Expand Down Expand Up @@ -215,51 +167,3 @@ jobs:
with:
name: Smokehouse (bundled)
path: .tmp/smokehouse-failures/

smoke-bundle-legacy:
strategy:
matrix:
smoke-test-shard: [1, 2, 3]
# e.g. if set 1 fails, continue with set 2 anyway
fail-fast: false
runs-on: ubuntu-latest
env:
# The total number of shards. Set dynamically when length of *single* matrix variable is
# computable. See https://github.community/t/get-length-of-strategy-matrix-or-get-all-matrix-options/18342
SHARD_TOTAL: 3
FORCE_COLOR: true
name: Bundled Legacy Navigation ${{ matrix.smoke-test-shard }}/3

steps:
- name: git clone
uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- run: yarn install --frozen-lockfile --network-timeout 1000000
- run: yarn build-report
- run: yarn build-devtools

- name: Define ToT chrome path
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV

- name: Install Chrome ToT
working-directory: /home/runner
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot

- run: sudo apt-get install xvfb
- name: yarn test-bundle
run: xvfb-run --auto-servernum yarn test-bundle --legacy-navigation --shard=${{ matrix.smoke-test-shard }}/$SHARD_TOTAL

# Fail if any changes were written to source files.
- run: git diff --exit-code

- name: Upload dist
if: failure()
uses: actions/upload-artifact@v1
with:
name: Smokehouse (bundled)
path: .tmp/smokehouse-failures/
6 changes: 0 additions & 6 deletions cli/test/smokehouse/frontends/smokehouse-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ async function begin() {
default: false,
describe: 'Save test artifacts and output verbose logs',
},
'legacy-navigation': {
type: 'boolean',
default: false,
describe: 'Use the legacy navigation runner',
},
'jobs': {
type: 'number',
alias: 'j',
Expand Down Expand Up @@ -218,7 +213,6 @@ async function begin() {
jobs,
retries,
isDebug: argv.debug,
useLegacyNavigation: argv.legacyNavigation,
lighthouseRunner: runLighthouse,
takeNetworkRequestUrls,
setup,
Expand Down
25 changes: 7 additions & 18 deletions cli/test/smokehouse/lighthouse-runners/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {once} from 'events';
import puppeteer from 'puppeteer-core';
import ChromeLauncher from 'chrome-launcher';

import {CriConnection} from '../../../../core/legacy/gather/connections/cri.js';
import {LH_ROOT} from '../../../../root.js';
import {loadArtifacts, saveArtifacts} from '../../../../core/lib/asset-saver.js';

Expand Down Expand Up @@ -47,7 +46,7 @@ if (!isMainThread && parentPort) {
/**
* @param {string} url
* @param {LH.Config|undefined} config
* @param {{isDebug?: boolean, useLegacyNavigation?: boolean}} testRunnerOptions
* @param {{isDebug?: boolean}} testRunnerOptions
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts}>}
*/
async function runBundledLighthouse(url, config, testRunnerOptions) {
Expand All @@ -72,28 +71,18 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
// @ts-expect-error - not worth giving test global an actual type.
const lighthouse = global.runBundledLighthouse;

/** @type {import('../../../../core/index.js')['legacyNavigation']} */
// @ts-expect-error - not worth giving test global an actual type.
const legacyNavigation = global.runBundledLighthouseLegacyNavigation;

// Launch and connect to Chrome.
const launchedChrome = await ChromeLauncher.launch();
const port = launchedChrome.port;

// Run Lighthouse.
try {
const logLevel = testRunnerOptions.isDebug ? 'verbose' : 'info';
let runnerResult;
if (testRunnerOptions.useLegacyNavigation) {
const connection = new CriConnection(port);
runnerResult =
await legacyNavigation(url, {port, logLevel}, config, connection);
} else {
// Puppeteer is not included in the bundle, we must create the page here.
const browser = await puppeteer.connect({browserURL: `http://localhost:${port}`});
const page = await browser.newPage();
runnerResult = await lighthouse(url, {port, logLevel}, config, page);
}

// Puppeteer is not included in the bundle, we must create the page here.
const browser = await puppeteer.connect({browserURL: `http://localhost:${port}`});
const page = await browser.newPage();
const runnerResult = await lighthouse(url, {port, logLevel}, config, page);
if (!runnerResult) throw new Error('No runnerResult');

return {
Expand All @@ -110,7 +99,7 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
* Launch Chrome and do a full Lighthouse run via the Lighthouse DevTools bundle.
* @param {string} url
* @param {LH.Config=} config
* @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
* @param {{isDebug?: boolean}=} testRunnerOptions
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
*/
async function runLighthouse(url, config, testRunnerOptions = {}) {
Expand Down
10 changes: 3 additions & 7 deletions cli/test/smokehouse/lighthouse-runners/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const execFileAsync = promisify(execFile);
* Launch Chrome and do a full Lighthouse run via the Lighthouse CLI.
* @param {string} url
* @param {LH.Config=} config
* @param {{isDebug?: boolean, useFraggleRock?: boolean}=} testRunnerOptions
* @param {{isDebug?: boolean}=} testRunnerOptions
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
*/
async function runLighthouse(url, config, testRunnerOptions = {}) {
Expand All @@ -46,11 +46,11 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
* @param {string} url
* @param {string} tmpPath
* @param {LH.Config=} config
* @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} options
* @param {{isDebug?: boolean}=} options
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
*/
async function internalRun(url, tmpPath, config, options) {
const {isDebug = false, useLegacyNavigation = false} = options || {};
const {isDebug = false} = options || {};
const localConsole = new LocalConsole();

const outputPath = `${tmpPath}/smokehouse.report.json`;
Expand All @@ -67,10 +67,6 @@ async function internalRun(url, tmpPath, config, options) {
'--quiet',
];

if (useLegacyNavigation) {
args.push('--legacy-navigation');
}

// Config can be optionally provided.
if (config) {
const configPath = `${tmpPath}/config.json`;
Expand Down
3 changes: 1 addition & 2 deletions cli/test/smokehouse/lighthouse-runners/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function setup() {
* CHROME_PATH determines which Chrome is used–otherwise the default is puppeteer's chrome binary.
* @param {string} url
* @param {LH.Config=} config
* @param {{isDebug?: boolean, useLegacyNavigation?: boolean}=} testRunnerOptions
* @param {{isDebug?: boolean}=} testRunnerOptions
* @return {Promise<{lhr: LH.Result, artifacts: LH.Artifacts, log: string}>}
*/
async function runLighthouse(url, config, testRunnerOptions = {}) {
Expand All @@ -50,7 +50,6 @@ async function runLighthouse(url, config, testRunnerOptions = {}) {
const {lhr, artifacts, logs} = await testUrlFromDevtools(url, {
config,
chromeFlags,
useLegacyNavigation: testRunnerOptions.useLegacyNavigation,
});

const log = logs.join('') + '\n';
Expand Down
2 changes: 0 additions & 2 deletions cli/test/smokehouse/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ All pruning checks:
- `_minChromiumVersion`
- `_maxChromiumVersion`
- `_legacyOnly`
- `_fraggleRockOnly`
- `_runner` (set to same value provided to CLI --runner flag, ex: `'devtools'`)
- `_excludeRunner` (set to same value provided to CLI --runner flag, ex: `'devtools'`)
Expand Down
21 changes: 2 additions & 19 deletions cli/test/smokehouse/report-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,9 @@ function makeComparison(name, actualResult, expectedResult) {
* @param {LocalConsole} localConsole
* @param {LH.Result} lhr
* @param {Smokehouse.ExpectedRunnerResult} expected
* @param {{runner?: string, useLegacyNavigation?: boolean}=} reportOptions
* @param {{runner?: string}=} reportOptions
*/
function pruneExpectations(localConsole, lhr, expected, reportOptions) {
const isLegacyNavigation = reportOptions?.useLegacyNavigation;

/**
* Lazily compute the Chrome version because some reports are explicitly asserting error conditions.
* @returns {string}
Expand Down Expand Up @@ -295,19 +293,6 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
`Actual Chromium version: ${getChromeVersionString()}`,
].join(' '));
remove(key);
} else if (value._legacyOnly && !isLegacyNavigation) {
localConsole.log([
`[${key}] marked legacy only but run is Fraggle Rock, pruning expectation:`,
JSON.stringify(value, null, 2),
].join(' '));
remove(key);
} else if (value._fraggleRockOnly && isLegacyNavigation) {
localConsole.log([
`[${key}] marked Fraggle Rock only but run is legacy, pruning expectation:`,
JSON.stringify(value, null, 2),
`Actual channel: ${lhr.configSettings.channel}`,
].join(' '));
remove(key);
} else if (value._runner && reportOptions?.runner !== value._runner) {
localConsole.log([
`[${key}] is only for runner ${value._runner}, pruning expectation:`,
Expand All @@ -325,8 +310,6 @@ function pruneExpectations(localConsole, lhr, expected, reportOptions) {
}
}

delete obj._legacyOnly;
delete obj._fraggleRockOnly;
delete obj._skipInBundled;
delete obj._minChromiumVersion;
delete obj._maxChromiumVersion;
Expand Down Expand Up @@ -483,7 +466,7 @@ function reportAssertion(localConsole, assertion) {
* summary. Returns count of passed and failed tests.
* @param {{lhr: LH.Result, artifacts: LH.Artifacts, networkRequests?: string[]}} actual
* @param {Smokehouse.ExpectedRunnerResult} expected
* @param {{runner?: string, isDebug?: boolean, useLegacyNavigation?: boolean}=} reportOptions
* @param {{runner?: string, isDebug?: boolean}=} reportOptions
* @return {{passed: number, failed: number, log: string}}
*/
function getAssertionReport(actual, expected, reportOptions = {}) {
Expand Down
Loading

0 comments on commit 54830c8

Please sign in to comment.