Skip to content

Conversation

gagan16k
Copy link
Member

What this PR does / why we need it:
Adds support for pagination in the GCP mock server and test to check that machine listing in the getVMs function works correctly when instances are spread across multiple pages.

  • Added a DefaultMockPageSize variable to pkg/gcp/fake/mockserver.go to control the number of instances per page in mock responses
  • Updated the handleList function in pkg/gcp/fake/mockserver.go, now slices the Instances array based on pageToken and maxResults, and sets NextPageToken when more items are available.
  • Added logging in pkg/gcp/machine_controller_util.go
  • Added a new test case in pkg/gcp/machine_controller_test.go that creates multiple machines, sets a small page size, and verifies that all machines are listed across paginated responses

Which issue(s) this PR fixes:
Similar to Orphan Safety Controller missing VM's due to large resource query on MCM provider-azure

Release note:

Add pagination support to GCP mock server, and test if machine listing works correctly when instances are spread across multiple pages. 

@gagan16k gagan16k requested review from a team as code owners October 16, 2025 12:15
@gardener-robot gardener-robot added needs/review Needs review size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Oct 16, 2025
@gardener-robot gardener-robot added size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) and removed size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Oct 16, 2025
@gardener-robot gardener-robot added size/s Size of pull request is small (see gardener-robot robot/bots/size.py) and removed size/m Size of pull request is medium (see gardener-robot robot/bots/size.py) labels Oct 16, 2025
Copy link
Member

@takoverflow takoverflow left a comment

Choose a reason for hiding this comment

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

Tested the pagination unit test locally, it seems to work fine. Just a minor nit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs/review Needs review size/s Size of pull request is small (see gardener-robot robot/bots/size.py)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants