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

test: use predictable numbers in golden LHR #6404

Merged
merged 8 commits into from
Oct 29, 2018
Merged

Conversation

paulirish
Copy link
Member

No more excluding items from the golden LHR.

@connorjclark
Copy link
Collaborator

connorjclark commented Oct 26, 2018

Can we rename sample_v2 to golden? :)

@paulirish
Copy link
Member Author

Can we rename sample_v2 to golden? :)

been wanting to for a while.

I'll do it after this PR

@brendankenny
Copy link
Member

what, it's not obvious what sample_v2 refers to?? :)

@brendankenny
Copy link
Member

for test failures, see #6405 :)

const lhr = JSON.parse(lhrString);
delete lhr.configSettings.auditMode;
Copy link
Member

Choose a reason for hiding this comment

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

was there an issue with having this previously? Was it only because we were generating it more manually?

Copy link
Member Author

Choose a reason for hiding this comment

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

its just this:

auditMode": "./lighthouse-core/test/results/artifacts",

hopefully it isn't an absolute path in some cases?

lhr.timing.total = 12345.6789;
lhr.timing.entries.forEach((entry, i) => {
// @ts-ignore
entry.duration = 100;
Copy link
Member

@brendankenny brendankenny Oct 26, 2018

Choose a reason for hiding this comment

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

why are these ignored? readonly? Maybe we don't want them to descend from PerformanceEntry after all :)

Should put a reason why it's being ignored. e.g. // @ts-ignore - write to readonly property or whatever

// Set to predictable and typical value
lhr.configSettings.auditMode = false;

// Set timing values, which change from run-to-run, to predicable values
Copy link
Member

Choose a reason for hiding this comment

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

no -

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we're jumping on the comments there's also a t missing from predictable :)

// @ts-ignore
entry.duration = 100;
// @ts-ignore
entry.startTime = 100 * i + i; // 1ms gap between them
Copy link
Member

Choose a reason for hiding this comment

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

if we add new entries this is going to cause some noise. What about based on length of the name or some kind of hash of the name or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

k. behold our new predictable timing trace!

image

Copy link
Member

@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.

Need to rebase to get rid of that short name audit, but otherwise LGTM!

@paulirish paulirish merged commit 85b8fcb into master Oct 29, 2018
@paulirish paulirish deleted the predictablenumbers branch October 29, 2018 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants