-
Notifications
You must be signed in to change notification settings - Fork 61
fix: CCAPI provider does not do pagination #678
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
| // eslint-disable-next-line no-console | ||
| console.log(result); |
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.
| // eslint-disable-next-line no-console | |
| console.log(result); |
d459e5d to
b84bdfb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
==========================================
+ Coverage 78.94% 78.96% +0.01%
==========================================
Files 46 46
Lines 7102 7102
Branches 793 797 +4
==========================================
+ Hits 5607 5608 +1
+ Misses 1476 1473 -3
- Partials 19 21 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| // This allows us to error out early, before we have consumed all pages. | ||
| if ((expectedMatchCount === 'at-most-one' || expectedMatchCount === 'exactly-one') && found.length > 1) { | ||
| throw new ContextProviderError(`Found ${found.length} resources matching ${JSON.stringify(propertyMatch)}; expected ${expectedMatchCountText(expectedMatchCount)}. Please narrow the search criteria`); |
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.
The error messages is technically wrong now. Maybe something like?
| throw new ContextProviderError(`Found ${found.length} resources matching ${JSON.stringify(propertyMatch)}; expected ${expectedMatchCountText(expectedMatchCount)}. Please narrow the search criteria`); | |
| throw new ContextProviderError(`Found more than one resources matching ${JSON.stringify(propertyMatch)}; expected ${expectedMatchCountText(expectedMatchCount)}. Please narrow the search criteria`); |
The CCAPI provider stops after the first page of results. This may cause for example EC2 Prefix Lists that exist to not be found, if they don't occur in the first page of results. Make the provider retrieve all pages of results. Also in this PR: - New SDK mocks had been added without them being added to all the places where they needed to be added to be reset properly. Instead, put them all into an object so we can do a reliable `for` loop that will never go out of date again.
b84bdfb to
d1b762d
Compare
The CCAPI provider stops after the first page of results. This may cause for example EC2 Prefix Lists that exist to not be found, if they don't occur in the first page of results.
Make the provider retrieve all pages of results.
Also in this PR:
forloop that will never go out of date again.MaxResultsto 100, so we need to do fewer paginations and the chances of the error message finding too many elements has a reasonable indicator of the number of resources actually found.Fixes #587
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license