-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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(smokehouse): gzip test to assert transfer and resource sizes #7286
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<!-- | ||
* Copyright 2019 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
--> | ||
<html> | ||
<head> | ||
<title>Gzip</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> | ||
<script src="script.js?gzip=1"></script> | ||
<script src="script.js"></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,4 +103,29 @@ module.exports = [ | |
}, | ||
}, | ||
}, | ||
{ | ||
requestedUrl: 'http://localhost:10200/byte-efficiency/gzip.html', | ||
finalUrl: 'http://localhost:10200/byte-efficiency/gzip.html', | ||
audits: { | ||
'network-requests': { | ||
details: { | ||
items: [ | ||
{ | ||
url: 'http://localhost:10200/byte-efficiency/gzip.html', | ||
}, | ||
{ | ||
url: 'http://localhost:10200/byte-efficiency/script.js?gzip=1', | ||
transferSize: 1136, | ||
resourceSize: 52997, | ||
}, | ||
{ | ||
url: 'http://localhost:10200/byte-efficiency/script.js', | ||
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. is this is just for exact comparison with the gzip? 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. Just the ?gzip=1 one is important for the regression test. This is just for comparing. And maybe it'd catch some other future issue? I'm open to removing. |
||
transferSize: 53181, | ||
resourceSize: 52997, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
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.
are these stable across platforms, like the native zlib mac/linux is the same byte-for-byte as js and transfer size is always the same and all that?
seems like we could loosen the assertion a bit
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.
Good question, no idea. For the purposes of the regression a ballpark is good enough (less than 1500 i guess).
Looks like travis / appveyor got the same thing I did.
This SO answer perhaps suggests that we can rely on zlib being the same? Interestingly there's a byte that represents the OS used, but that wouldn't change the length. You've got me curious now so I'm gonna dig in way deeper than necessary :P
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.
Any findings from the 🐰 🕳 ?
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.
Just that it may change when Node upgrades zlib, but they haven't update it in years. Seems fine to punt.