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

tests(smoke): support full chrome version for pruning #13896

Merged
merged 2 commits into from
Apr 22, 2022
Merged

Conversation

connorjclark
Copy link
Collaborator

Two commits here:

  1. Add full version string support for the _minChromium/_maxChromium properties. Just the milestone number is too coarse to be useful for addressing regressions that have immediately occurred in ToT (but not landed in canary).
  2. temporarily ignore smoke failure for deprecations audit, so unblock CI. see InspectorIssues protocol no longer contains message strings for deprecations #13895

@connorjclark connorjclark requested a review from a team as a code owner April 21, 2022 23:34
@connorjclark connorjclark requested review from brendankenny and removed request for a team April 21, 2022 23:34
// TODO: translate these strings.
// see https://github.com/GoogleChrome/lighthouse/issues/13895
// @ts-expect-error: .type hasn't released to npm yet
.filter(deprecation => !deprecation.type || deprecation.type === 'Untranslated')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is what ToT CDT does right now (but not for much longer, there's a pending CL): just hides these translated strings.


describe('report-assert', () => {
it('compares chromium versions correctly', async () => {
expect(compareChromiumVersions([100, 0, 0, 0], [100, 0, 0, 0])).toBe(0);
Copy link
Member

Choose a reason for hiding this comment

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

ideally if we're going to be exporting a function and testing it, it would be the whole kit and caboodle, like expect(failsChromeVersionCheck(hostVersion, {_minChromiumVersion: '100'}).toBe(whatever)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

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.

Oh, I meant more like

/**
 * @param {string} hostVersionString
 * @param {*} obj
 */
function failsChromeVersionCheck(hostVersionString, obj) {
  const hostVersion = hostVersionString.split('.').map(Number); // or keep parseVersion()
  if (obj._minChromiumVersion) {
    const minVersion = obj._minChromiumVersion.split('.').map(Number);
    for (let i = 0; i < hostVersion.length; i++) {
      if (hostVersion[i] < minVersion[i]) return true;
    }
  }
  if (obj._maxChromiumVersion) {
    const maxVersion = obj._maxChromiumVersion.split('.').map(Number);
    for (let i = 0; i < hostVersion.length; i++) {
      if (hostVersion[i] > maxVersion[i]) return true;
    }
  }

  return false;
}

so it's not in several pieces and it avoids having to remember the -1/1 convention.

Up to you, but let's land whatever so we can unblock CI

@connorjclark
Copy link
Collaborator Author

Framing it as a comparator function helps me understand (or at least write?) these things better, so I'll keep it like this. splitting it out is a good for readability, thanks for recommending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants