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

tests: refactor smokehouse for extensibility #9843

Merged
merged 8 commits into from
Nov 5, 2019
Merged

tests: refactor smokehouse for extensibility #9843

merged 8 commits into from
Nov 5, 2019

Conversation

brendankenny
Copy link
Member

smokehouse has acquired a lot of layers over time, and it can be pretty difficult to reason about the exact control flow at times. This PR aims to rectify that, boiling it down to a simple structure (albeit with some fiddliness because nice logging is always fiddly in the end).

Basically all functionality and behavior is maintained except

  • all tests that can be run in parallel are done so independently (no batches). This allows for better utilization (saves about 40 seconds on my machine, though it's still bottlenecked by the serial tests)
  • retries happen per test, rather than re-running the entire test group
  • retries, parallel run count, etc are supplied as options/flags, so even if not in CI you can take advantage of them without having to yarn smoke || yarn smoke || yarn smoke. Try out yarn smoke -j 15 --retries 2 :)
  • path of the test definitions can now be supplied, opening up the smoke test runner to other folks like plugins (cc @jburger424)
  • added the start of a readme for posterity

bundle stuff (running a bundle, running as a bundle, aka firehouse) to come next from the end points established here, this just needed a cutoff point before it got too big.

@brendankenny
Copy link
Member Author

and as far as I can tell there's nothing here that would hinder movement to #8962, @patrickhulce :)

Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

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

First pass comments, would like to look closer later. Looks great!

Copy link
Member Author

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

Thanks for the review! Changes only half finished, I'll push later.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

love the cleanup, docs, and overall structure of this!


## Test definitions

| Name | Type | Description |
Copy link
Collaborator

Choose a reason for hiding this comment

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

gotta run prettier on these tables man, it's oh so good ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

gotta run prettier on these tables man, it's oh so good ;)

ha, didn't know it would format tables. I'll try it out to see what happens :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

ping :)

Copy link
Member Author

Choose a reason for hiding this comment

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

ping :)

well I tried it and it seemed to help on some tables and not others so...who knows :)

| node +---------->+ smokehouse.js +-----+
| | | | | | +--------------+
+------------+ | +-------+-------+ | | |
| ^ +-->+ bundled+LH |
Copy link
Collaborator

Choose a reason for hiding this comment

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

is bundledLhRunner the only other candidate for the -bin runner or are our other hopes for smokehouse/firehouse also going to be runners

Copy link
Member Author

Choose a reason for hiding this comment

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

is bundledLhRunner the only other candidate for the -bin runner or are our other hopes for smokehouse/firehouse also going to be runners

yes, the bundled/firehouse runner would be the only other runner I know of at this point, but we could conceivably have a dt vs lr bundle runner (or someday some kind of pptr runner), for instance.

@brendankenny
Copy link
Member Author

@patrickhulce and @paulirish, do you want to take another look or are you 🍬

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

ya this LGTM 👍

* A class that maintains a concurrency pool to coordinate many jobs that should
* only be run `concurrencyLimit` at a time.
* API inspired by http://bluebirdjs.com/docs/api/promise.map.html, but
* independent callers of `concurrentMap()` share the same concurrency limit.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* independent callers of `concurrentMap()` share the same concurrency limit.
* independent callers of `pooledMap()` share the same concurrency limit.


## Test definitions

| Name | Type | Description |
Copy link
Collaborator

Choose a reason for hiding this comment

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

ping :)

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

just nits on naming and directory structure.

/**
* CLI entry point.
*/
async function cli() {
Copy link
Member

Choose a reason for hiding this comment

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

in LH's bin.js we have the equivalent function called begin()
that seems good

if not, i'd go with bin() before using cli()


const assetSaver = require('../../../../lighthouse-core/lib/asset-saver.js');
const LocalConsole = require('../local-console.js');
const ChildProcessError = require('./child-process-error.js');
Copy link
Member

Choose a reason for hiding this comment

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

move this into a smokehouse/lib/ folder?

### Frontends
- `frontends/smokehouse-bin.js` - runs smokehouse from the command line
- TODO: bundle-entry - simple entrypoint to smokehouse for bundling and running in a browser.
- `smokehouse.js` - smokehouse itself is runnable from node
Copy link
Member

Choose a reason for hiding this comment

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

having this here in this list but not in the folder threw me for a loop. also smokehouse.js listed here and in the next section. 😕

can you add a frontend/node.js that just module.exports = require('../smokehouse.js'); ?

that'd help my mental model of this thing.

const cliLighthouseRunner = require('./lighthouse-runners/cli.js').runLighthouse;
const getAssertionReport = require('./report-assert.js');
const LocalConsole = require('./local-console.js');
const ConcurrentMapper = require('./concurrent-mapper.js');
Copy link
Member

Choose a reason for hiding this comment

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

move concurrentmapper/localconsole/reportassert into a ./lib ?

const smokeTests = require('./smoke-test-dfns.js');
const {collateResults, report} = require('./smokehouse-report.js');
const smokeTests = require('./test-definitions/core-tests.js');
const report = require('./report-assert.js');
Copy link
Member

Choose a reason for hiding this comment

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

(commenting here for no reason)

Firehouse should move into runners, right?

(i wouldnt mind changing the name now because i totally forget what its there for)

Copy link
Collaborator

Choose a reason for hiding this comment

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

--runner needs a concrete way to run Lighthouse, but Firehouse doesn't even provide that. You'd use it to create what would be a frontend, one capable of tweaking expectations.

AFAIU if a 'runner' could also tweak expectations like firehouse.js does, we can delete firehouse.js

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAIU if a 'runner' could also tweak expectations like firehouse.js does, we can delete firehouse.js

I'll follow up with my proposal to get all these needs addressed. Should be a small (hopefully negative) diff :)

Copy link
Member

@paulirish paulirish Nov 5, 2019

Choose a reason for hiding this comment

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

gotcha that makes sense. almost like a lib/expectation-filterer.js

or wait... EXPECTATION-SIEVE.JS

🔥

Copy link
Collaborator

Choose a reason for hiding this comment

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

smoke-mask 😷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants