-
Notifications
You must be signed in to change notification settings - Fork 736
test(amazonq): add performance test for prepareRepoData #5670
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
Conversation
packages/core/src/test/amazonqFeatureDev/prepareRepoData.test.ts
Outdated
Show resolved
Hide resolved
| } | ||
| /** | ||
| * Tests 250 files w/ 10 bytes each. | ||
| * Running more files can lead to flaky test from timeout. |
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.
would there be any value on seeing how this number scales? e.g. for every 50 files it roughly increases the duration by 2 or is it too unpredictable?
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.
duration in general was very flaky on this one, and also it seemed to not scale linearly. I would be surprised based on what I've seen so far if an increase of 50 files corresponded so some constant duration increase. I could look into it with less files.
| zipFileChecksum: string | ||
| } | ||
|
|
||
| describe('prepareRepoDataPerformanceTest', function () { |
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'd probably just have a top level describe thats prepareRepoData and then a second describe that has performance test in it, that way it can easily seperate perf tests from non perf tests if anyone wants to add it
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.
There are also some existing correctness tests in test/unit/amazonqFeatureDev/util/files.test.ts. I kept the performance tests in core since thats where the startSecurityScan is (src/test/codewhisperer/commands/startSecurityScan.test.ts).
## Problem Last PR: #5670 was not rebased onto a386cc3, so did not include relevant telemetry changes. Therefore tests passed until the merge happened. ## Solution change type signature to reflect telemetry changes. --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem Continuation of #5670 ## Solution same as previous --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem continuation of performance test work: #5670 ## Solution same as previous. CPU threshold set very high because it spikes pretty wildly on this one.  --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…hieve. (#5710) ## Problem Continuation of work here: #5670 ## Solution In this case `downloadExportResultArchieve` is reading a large collection of objects into a buffer, then writing that buffer to a file. We test this with varying collections of objects. We test 1x1KB, 10x100B, 100x10B, and 1000x1B. --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem Continuation of aws#5670 ## Solution same as previous --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
## Problem continuation of performance test work: aws#5670 ## Solution same as previous. CPU threshold set very high because it spikes pretty wildly on this one.  --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
…hieve. (aws#5710) ## Problem Continuation of work here: aws#5670 ## Solution In this case `downloadExportResultArchieve` is reading a large collection of objects into a buffer, then writing that buffer to a file. We test this with varying collections of objects. We test 1x1KB, 10x100B, 100x10B, and 1000x1B. --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Problem
Start of reliability work to enhance performance testing of high risk code paths.
Solution
prepareRepoDatainsrc/amazonqFeatureDev/util/files.tscaptures many potentially high risk paths in a single function, such ascollectFilesand other I/O operations, making it a great place to start performance testing.Two performance tests were added, one for handling a workspace with many small files, and one with few large files. Unsurprisingly, the performance is significantly better on fewer larger files as it reduces # of I/O operations. Thresholds are very lenient to avoid flaky tests.
The "many files" test does 250 files w/ 10 bytes each. The "large files" does 10 files w/ 1000 bytes each. These values were chosen to avoid flakiness in CI.
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.