Skip to content

Conversation

@zliang-akamai
Copy link
Member

📝 Description

This may be helpful to reduce intermittent errors during integration tests.

✔️ How to Test

Run any test you like, for example:

python -m pytest test/integration/models/linode/test_linode.py -k test_get_linode -v

@zliang-akamai zliang-akamai marked this pull request as ready for review December 1, 2025 21:04
@zliang-akamai zliang-akamai requested a review from a team as a code owner December 1, 2025 21:04
@zliang-akamai zliang-akamai requested review from jriddle-linode and lgarber-akamai and removed request for a team December 1, 2025 21:04
@zliang-akamai zliang-akamai added the testing for updates to the testing suite in the changelog. label Dec 1, 2025
@zliang-akamai
Copy link
Member Author

Should be bypassed if the token doesn't have account API access. Converting to draft to work on it.

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

LGTM other than the comment above, great work!

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

Works locally, looks good!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +91 to +102
and set(capabilities)
.intersection(ALL_ACCOUNT_AVAILABILITIES)
.issubset(
account_regional_availabilities.get(
v.id,
(
[]
if account_regional_availabilities
else ALL_ACCOUNT_AVAILABILITIES
),
)
)
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The nested conditional logic with multi-line set operations is difficult to read and understand. Consider extracting this logic into a separate helper function (e.g., is_region_available_for_capabilities) that takes the region, capabilities, and account_regional_availabilities as parameters. This would improve readability and make the code easier to test and maintain.

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +92
and set(capabilities)
.intersection(ALL_ACCOUNT_AVAILABILITIES)
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The set intersection set(capabilities).intersection(ALL_ACCOUNT_AVAILABILITIES) is computed for every region in the list comprehension. Consider calculating this once before the list comprehension and storing it in a variable to avoid redundant computation.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing for updates to the testing suite in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants