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

chore: added memory tests for missing packages #4264

Merged
merged 7 commits into from Apr 30, 2024

Conversation

TarunAdobe
Copy link
Contributor

@TarunAdobe TarunAdobe commented Apr 12, 2024

Added memory tests for remaining packages.

Objective

fixes #3722

Background

Memory leaks in web applications can lead to performance issues and degraded user experience. By adding memory tests to each package in the component library, we can proactively identify and fix potential memory leaks, ensuring the overall stability and performance of the library.

Related Issue:

Building on top of #4228

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@TarunAdobe TarunAdobe assigned TarunAdobe and unassigned TarunAdobe Apr 12, 2024
Copy link

github-actions bot commented Apr 12, 2024

Branch preview

Copy link

github-actions bot commented Apr 12, 2024

Tachometer results

Currently, no packages are changed by this PR...

Copy link

github-actions bot commented Apr 15, 2024

Lighthouse scores

Category Latest (report) Main (report) Branch (report)
Performance 0.98 0.99 0.99
Accessibility 1 1 1
Best Practices 1 1 1
SEO 1 0.92 0.92
PWA 1 1 1
What is this?

Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.

Transfer Size

Category Latest Main Branch
Total 229.517 kB 210.281 kB 🏆 210.551 kB
Scripts 61.152 kB 48.105 kB 🏆 48.158 kB
Stylesheet 35.695 kB 30.39 kB 🏆 30.578 kB
Document 5.958 kB 5.189 kB 🏆 5.191 kB
Font 126.712 kB 126.597 kB 🏆 126.624 kB

Request Count

Category Latest Main Branch
Total 43 🏆 45 45
Scripts 35 🏆 37 37
Stylesheet 5 5 5
Document 1 1 1
Font 2 2 2

@Rajdeepc Rajdeepc requested review from a team and removed request for Rajdeepc April 22, 2024 06:35
Comment on lines 17 to 20
testForMemoryLeaks(
async () =>
await fixture<ActionButton>(BlackActionButton(BlackActionButton.args))
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this is useful or not, but should we signature of this method so it works along the lines of:

Suggested change
testForMemoryLeaks(
async () =>
await fixture<ActionButton>(BlackActionButton(BlackActionButton.args))
);
testForMemoryLeaks<ActionButton>(BlackActionButton(BlackActionButton.args));

I'm not 100% sure the type is even technically required as we're not testing against its actual API here.

Maybe I'm being overly precious and it's not worrying about, but I'm less excited by the ones blow out to the following by the linter:

testForMemoryLeaks(
    async () =>
        await fixture<Underlay>(
            html`
                <sp-underlay></sp-underlay>
            `
        )
);

With this change, it would technically be the below:

testForMemoryLeaks<Underlay>(html`<sp-underlay></sp-underlay>`);

Or even less is the type is unneeded.

🤔

Copy link
Contributor

@Rajdeepc Rajdeepc Apr 23, 2024

Choose a reason for hiding this comment

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

I think it does improve the readability and conciseness of the test calls but as you rightfully said since we are testing for memory leaks without the knowledge or manipulation of the component's API, we might not need to add the type here.

@Rajdeepc Rajdeepc self-requested a review April 23, 2024 08:33
@adobe adobe deleted a comment from changeset-bot bot Apr 25, 2024
@Rajdeepc Rajdeepc requested a review from Westbrook April 29, 2024 11:00
Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

These changes look good, but we need to make sure CI is passing before we can merge.

Separately, we'll need to file some follow up work to get this test into the component generator, but not reason to block progress on that. Can you also work with the three in progress new component PRs to ensure this test is included therein?

@Rajdeepc
Copy link
Contributor

These changes look good, but we need to make sure CI is passing before we can merge.

Separately, we'll need to file some follow up work to get this test into the component generator, but not reason to block progress on that. Can you also work with the three in progress new component PRs to ensure this test is included therein?

Yes sure! Also will update the express team to include these memory tests into their alert banner and breadcrumb PRs

@Rajdeepc Rajdeepc requested a review from Westbrook April 29, 2024 13:59
@Westbrook
Copy link
Collaborator

We can merge this, because it is green. However, this causes the Chromium tests to take more the 4 minutes when they were previously taking less and a minute. Do we want to look at other options now or ship this and revisit timing/concurrency/segmentation of tests at a later date?

@Rajdeepc
Copy link
Contributor

Rajdeepc commented Apr 29, 2024

We can merge this, because it is green. However, this causes the Chromium tests to take more the 4 minutes when they were previously taking less and a minute. Do we want to look at other options now or ship this and revisit timing/concurrency/segmentation of tests at a later date?

Yes there is a need to optimize the build time here! Its taking forever. Concurrency shards the build but delays the build time. Its better to segregate the memory test and check this in a separate PR, If you think this is fine let's merge this!

@Rajdeepc
Copy link
Contributor

@Westbrook Can we land this?

Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Let's hit up optimization in a follow up.

:shipit: 🙇🏼

@Westbrook Westbrook merged commit ac67fa2 into main Apr 30, 2024
48 checks passed
@Westbrook Westbrook deleted the chore/add-more-memory-tests branch April 30, 2024 12:37
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.

[testing] Abstract and apply memory usage testing across the repo
3 participants