-
Notifications
You must be signed in to change notification settings - Fork 9.6k
tests(smokehouse): filter tests by url, print rerun command #9676
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
Conversation
patrickhulce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat! I'm suspecting this might have a few bad interactions though with some of the audits that are added just so we can assert something on artifacts and whatnot, but I don't have great ideas for that
Co-Authored-By: Patrick Hulce <[email protected]>
good point. should be good now. |
brendankenny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this serving a current need? Each smokehouse definition is pretty short on its own, typically is limited to audits that will individually trigger the same number of passes anyway, and I don't think I'm ever going to remember one of the URLs off the top of my head, if only for the port numbers alone :)
This seems more suited for a different definition setup, where each smoke test runs the full default config over each test page instead of each being pruned by hand (which may or may not be sustainable much longer, who knows).
Investigating any specific failure in the smoke tests requires pruning away what you don't want, which has become a step I really dislike.
The bit that spits out the exact command to re-run the failures doesn't require remembering any URLs. |
audit pruning doesn't seem like it would help, though? They're already silenced if they're passing. If an expectations file has more than one url in it is annoying if the failure is in e.g. the last one, that's a good point (though we don't require URLs to be unique) |
patrickhulce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what the status of this effort is, but I'm fine either way. seems useful to me but I understand not churning smoke tests too 🤷♂
| `--expectations-path=${expectations}`, | ||
| ].join(' '); | ||
| ]; | ||
| if (argv.onlyAudits) commandParts.push(`--only-audits ${argv.onlyAudits.join(' ')}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these be pushed separately? feels weird to double join with " "
|
been a while but came here because i really want url filtering.
...
yeah i do this all the time. i comment out the other URLs (and their expectations) in an expectation file. super annoying. (I care less about only-audits and currently i dont think i'd really use it) one thought: going in another direction, maybe each expectation file should only be for a single URL. we currently have 39 URLs we load. and they're defined across 16 files. (the 16 are selectable as 'pwa', 'dbw' 'pwa2', etc etc). does anyone feel like it should be 1 file per tested LH run? |
|
I'm more open to "one url per expectation file" now, but there is the extra complication that some files (like I suggest opening a new issue to talk more about it / schedule a talk during eng sync. I will update this PR now. |
patrickhulce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a nice intermediate step, thanks for fixing up :)
| } | ||
|
|
||
| const exitCode = isPassing ? 0 : 1; | ||
| const failingUrls = testResults.testResults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the variable be something like smokehouseResult? testResults.testResults twitches my nose a bit :)
| console.log(usage); | ||
| } | ||
|
|
||
| if (onlyUrls) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interaction with invertMatch is a little confusing now, maybe warrants some documentation on the method and/or CLI help?
long-term fix might be a skipUrls parallel :)
brendankenny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is relatively straightforward, but it's also treating url as an id, so every test has two IDs. This results in things like every smokehouse result being double keyed and being confusing which ID you need to look at to evaluate success (at the expectation level or the url level), the unclear interplay between --invert-match and --only-urls, etc.
It's a slightly more painful transition, but it does seem like @paulirish is right that making a change to 1 ID <=> 1 test solves all this more simply.
| smokes = smokes.filter(smoke => { | ||
| smoke.expectations = smoke.expectations.filter(expectation => { | ||
| const url = expectation.lhr.requestedUrl; | ||
| const shouldRunUrl = onlyUrls.some(pattern => new RegExp(pattern).test(url)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new RegExp(pattern)
it seems like this would be a problem with some of the gnarlier URLs when c/p verbatim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new RegExp(pattern)it seems like this would be a problem with some of the gnarlier URLs when c/p verbatim
actually they look mostly ok, it's just the test urls with querystrings that break it, since ? won't match itself in new RegExp(urlWithQuery).test(urlWithQuery)
(are there other metacharacters that aren't usually url encoded that could make their way into one of our test URLs?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked my friend SO for help.
| 'node', | ||
| path.relative(process.cwd(), __filename), | ||
| // This is the good bit. | ||
| `--only-urls ${failingUrls.join(' ')}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ampersands, at least, are an issue for me without quoting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed with a child_process hack. too bad it doesn't expose a function "give me formatted command".
|
this is mostly replaced by the each-url-a-test refactor, but I would like to close and follow up with a small change that does the "print a command to rerun failures" thing this PR did. |
EDIT: just doing
--only-urlsin this PR.[original message]
Two new flags to run a subset of smoke tests:
--only-auditsand--only-urlsAlso, if one of the batches fails, a command to rerun the failures is printed: