Skip to content

Conversation

@cjgajard
Copy link
Member

@cjgajard cjgajard commented Dec 4, 2025

+go test ./pagerdutyplugin -run TestAccPagerDutyTeamMembership -v
=== RUN   TestAccPagerDutyTeamMembership_import
--- PASS: TestAccPagerDutyTeamMembership_import (19.25s)
=== RUN   TestAccPagerDutyTeamMembership_importWithRole
--- PASS: TestAccPagerDutyTeamMembership_importWithRole (18.71s)
=== RUN   TestAccPagerDutyTeamMembership_Basic
--- PASS: TestAccPagerDutyTeamMembership_Basic (18.29s)
=== RUN   TestAccPagerDutyTeamMembership_WithRole
--- PASS: TestAccPagerDutyTeamMembership_WithRole (18.23s)
=== RUN   TestAccPagerDutyTeamMembership_WithRoleConsistentlyAssigned
--- PASS: TestAccPagerDutyTeamMembership_WithRoleConsistentlyAssigned (30.29s)
=== RUN   TestAccPagerDutyTeamMembership_DestroyWithEscalationPolicyDependant
--- PASS: TestAccPagerDutyTeamMembership_DestroyWithEscalationPolicyDependant (47.08s)
=== RUN   TestAccPagerDutyTeamMembership_DestroyWithEscalationPolicyDependantAndMultipleTeams
--- PASS: TestAccPagerDutyTeamMembership_DestroyWithEscalationPolicyDependantAndMultipleTeams (63.89s)
PASS

Copy link

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 adds proper pagination support to the requestGetTeamMembership function to handle teams with more than 100 members. Previously, the function only fetched the first page of team members, which could result in missing memberships if a team had many members.

Key Changes:

  • Implemented a pagination loop that continues fetching pages until all team members are checked
  • Added offset tracking and the "more" flag to properly iterate through all pages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

more = resp.More
offset += resp.Limit
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The offset increment uses resp.Limit which could potentially be 0 or different from the requested limit. This could lead to an infinite loop or incorrect pagination. Consider using the requested limit (100) instead: offset += 100

Suggested change
offset += resp.Limit
offset += 100

Copilot uses AI. Check for mistakes.
@cjgajard cjgajard merged commit 5e2791e into master Dec 4, 2025
19 checks passed
@cjgajard cjgajard deleted the cjavier/team-membership-pagination branch December 4, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants