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
Use local validator binary for tests #10158
Use local validator binary for tests #10158
Conversation
.travis.yml
Outdated
@@ -52,6 +52,9 @@ matrix: | |||
username: "amphtml" | |||
jwt: | |||
secure: "Wze0F0vGL0UcxryOx1n/vcuD5LIMGyR+69Nc6IWLoRvZBbbIpFwVFhDE6rE9ranIXiA2Hc684N4sV8ASfNDF8RRSB+jyLov159qwgji2rBxIfQ/4kuDV2vYoAJvYMz8m42kwx5FV2VV9awqMMt8mwU3wYIrKIaVCxB34uV86KIlDlbrHxt17Bm5EIiUmwi9r1AAnW/63vVRUN264D77oB4j9UQ759PfD6BDwEt54O87KurNIaLseNCr1IvzfL8veEsZ3uTbLC1GtgHfR4IGgkS2YyN2QIk06VZWeRDEOalS3RcY0nDkbCmBywxIGObnrpEMzOpjBiOb2fxLoLvvpjlla5W84zJGfWE6q4T9IvkyHuDJE+sft5B+arjMIeA6PIeUhKdV27+6qqDEf7fILZ/U/Ekn9ds4zSV8hekAZPUyyPncOeyWppCIJ8sOeCrsebkRjH1BoX/d+FE+nP0bN/XkBpIi/nManx5FyS/kqjQWGKmvsFQfEWlSUaZi7XtEQEjvBizRkzvpJanSDaoiTDS2Keulmwii3XRId51FuGtnfDZFeggLaMTKGfBX9DlPkccwYAZe6vPNfYk1pNgEj6AtnifEhYVEO+aAuWhEnJ86od+1wDOL/h+a2XY6h8/gFBywsD95p7sXPfdVDCKgwagiBo+Hw5MNjztVF7lszg1A=" | |||
packages: | |||
- protobuf-compiler | |||
- python-protobuf |
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.
@rsimha-amp Should we move sauce_connect
and jwt
above to the top-level addons
to avoid dupe here?
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 explicitly moved the addon to inside the integration_tests
shard, since we don't want to unnecessarily do a sauce connect for the other shard, which doesn't run the integration tests.
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.
To clarify, did you mean that there are two addons
sections, one at the top level, and one within the shard? If so, that is intentional for the reason I cited above.
I also noticed that you are now calling buildValidator
in both shards. If that function relies on the packages you've added here, you'll need to move them to the top-level section.
Edit: From the Travis build, it looks like they are needed in both shards.
build-system/pr-check.js
Outdated
} | ||
if (process.env.BUILD_SHARD == "integration_tests") { | ||
command.cleanBuild(); | ||
command.buildRuntimeMinified(); | ||
command.runPresubmitTests(); // Needs runtime to be built and served. | ||
command.runIntegrationTests(); | ||
command.buildValidator(); |
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.
By always doing this in both shards (instead of just in the unit_tests shard and only for validator changes), we're adding an extra 2m 30s to the Travis build cycle. I'm guessing there's no way to avoid this, right?
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.
Actually, looks like the test doesn't run on sauce labs anyways (skipSauceLabs()
), so we can move it out of the test/integration
folder and run it as a unit test instead. Doing that now.
if (!window.validatorLoad) { | ||
window.validatorLoad = (function() { | ||
const s = document.createElement('script'); | ||
s.src = 'https://cdn.ampproject.org/v0/validator.js'; | ||
s.src = '/validator/dist/validator_minified.js'; // Served by app.js. |
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 could've sworn that the google3 style guide requires 2 spaces between ;
and //
for inline comments, but I can't cite a source. I guess you're off the hook? :)
build-system/pr-check.js
Outdated
@@ -376,7 +377,8 @@ function main(argv) { | |||
command.runDepAndTypeChecks(); | |||
// Skip unit tests if the PR only contains changes to integration tests. | |||
if (buildTargets.has('RUNTIME')) { | |||
command.runUnitTests(); | |||
command.buildValidator(); |
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.
If this is run, line 388 will be duplicated work, and will add an extra 2m 30s to each build, increasing the total Travis CPU time by about 5 minutes (see my other comment for line 298). At a minimum, we'd need to change the if
case in line 387 to buildTargets.has('VALIDATOR') && !buildTargets.has('RUNTIME')
build-system/pr-check.js
Outdated
@@ -398,7 +400,8 @@ function main(argv) { | |||
util.colors.cyan('test/integration')); | |||
command.cleanBuild(); | |||
command.buildRuntimeMinified(); |
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.
Sorry about the multi-part review. I wonder if validator_minified.js
is generated by buildRuntimeMinified
, which calls gulp dist --fortesting
. If so, we can avoid the call to buildValidator
before calling runIntegrationTests
.
dd27a1e
to
8081e54
Compare
build-system/pr-check.js
Outdated
@@ -286,7 +286,7 @@ function runAllCommands() { | |||
command.runVisualDiffTests(); | |||
command.runJsonAndLintChecks(); | |||
command.runDepAndTypeChecks(); | |||
command.runUnitTests(); | |||
command.runUnitTests(); // Requires validator to be built. |
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 line can be reverted, right?
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.
Done.
c73772c
to
dcb56ea
Compare
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.
Yay, much simpler and cleaner :)
From https://travis-ci.org/ampproject/amphtml/jobs/247691456, it looks like you're now trying to use minified js in the unit tests shard, which only does a |
e19575f
to
3cea7ee
Compare
Fixes #10154.
/to @rsimha-amp /cc @Gregable @cramforce