-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add artifacts upload for the performance tests #48243
Changes from all commits
d195d10
98bee75
8fe36ce
562cde7
fcf67c6
4f32c7a
43acd1c
6971dec
bbdd33c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,10 +182,24 @@ function curateResults( testSuite, results ) { | |
* @return {Promise<WPPerformanceResults>} Performance results for the branch. | ||
*/ | ||
async function runTestSuite( testSuite, performanceTestDirectory, runKey ) { | ||
await runShellScript( | ||
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`, | ||
performanceTestDirectory | ||
); | ||
try { | ||
await runShellScript( | ||
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`, | ||
performanceTestDirectory | ||
); | ||
} catch ( error ) { | ||
fs.mkdirSync( './__test-results/artifacts', { recursive: true } ); | ||
const artifactsFolder = path.join( | ||
performanceTestDirectory, | ||
'artifacts/' | ||
); | ||
await runShellScript( | ||
'cp -Rv ' + artifactsFolder + ' ' + './__test-results/artifacts/' | ||
); | ||
|
||
throw error; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why should we only copy these if we fail? would we not want to upload them unconditionally so we can examine them even when the tests pass? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK artifacts are not created for successful tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aha, hm. I guess none of this would fail if we run it unconditionally? you're saying that the test runner doesn't create artifacts when the tests all pass? just asking here because I've found it useful to analyze successful test results (e.g. the performance traces), but if they're not present then I guess there's no point. the this is fine as it is, but I think it'd also be fine to leave the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The artifacts I'm trying to handle here are test failure ones, which include a page screenshot and HTML snapshot (at the moment of failure). This is different from the performance results json that we create only if the tests pass.
We need this try/catch block here because otherwise, it would never get to the part where we copy the created artifacts. I agree, though, that it would be better only to wrap the bit where we run the tests ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
const resultsFile = path.join( | ||
performanceTestDirectory, | ||
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json` | ||
|
@@ -198,6 +212,7 @@ async function runTestSuite( testSuite, performanceTestDirectory, runKey ) { | |
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json` | ||
) | ||
); | ||
|
||
return curateResults( testSuite, rawResults ); | ||
} | ||
|
||
|
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 think there's a mismatch between "COMMITTED_AT" and "commit_details.data.author.data" whereby the author can choose a time for the commit but the actual time of commit is different.
we should also be able to skip the network call from JS and use the commit sha directly with
git
. it looks like we're trying to get the seconds since Jan. 1, 1970?In this case
%at
shows the "author time" while%ct
shows the "commit time." For common work in this repo the difference is largely when did the author last finish writing the code and when was the code merged into the project.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.
Nice catch, PR here #48673