Filter regions based on account availabilities in get_regions function#625
Conversation
|
Should be bypassed if the token doesn't have account API access. Converting to draft to work on it. |
lgarber-akamai
left a comment
There was a problem hiding this comment.
LGTM other than the comment above, great work!
jriddle-linode
left a comment
There was a problem hiding this comment.
Works locally, looks good!
There was a problem hiding this comment.
Pull request overview
This PR enhances the get_regions function to filter regions based on account-level availability constraints, helping to reduce intermittent errors during integration tests by ensuring selected regions have the necessary capabilities enabled for the account.
Key Changes:
- Added account availability checking to filter regions based on account-specific capabilities
- Added error handling with logging for cases where account availability retrieval fails
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| account_regional_availabilities.get( | ||
| v.id, | ||
| ( | ||
| [] | ||
| if account_regional_availabilities | ||
| else ALL_ACCOUNT_AVAILABILITIES | ||
| ), | ||
| ) |
There was a problem hiding this comment.
The conditional logic for the default value is complex and could be confusing. Consider extracting this into a named variable or helper function to clarify the intent: when account availability data is present but a region is missing, default to empty list (no availability); when no account data was retrieved at all, assume all capabilities are available.
lgarber-akamai
left a comment
There was a problem hiding this comment.
LGTM, great work!
📝 Description
This may be helpful to reduce intermittent errors during integration tests.
✔️ How to Test
Run any test you like, for example: