Skip to content

cleanup: pagination tests#1703

Merged
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:test-pagination
Apr 4, 2025
Merged

cleanup: pagination tests#1703
dbolduc merged 1 commit intogoogleapis:mainfrom
dbolduc:test-pagination

Conversation

@dbolduc
Copy link
Member

@dbolduc dbolduc commented Apr 3, 2025

The gaxi pagination tests use a custom Client, which will not stay in step with our generated code.

pub fn list_stream(
&self,
req: ListFoosRequest,
) -> Paginator<ListFoosResponse, gax::error::Error> {
let inner = self.inner.clone();
let execute = move |page_token| {
let mut request = req.clone();
request.page_token = page_token;
let client = Self {
inner: inner.clone(),
};
client.list_impl(request)
};
Paginator::new(String::new(), execute)
}

We would rather use a real client. While we could send real requests to a fake server at some local endpoint, it seems even better to just stub out the transport.

Add direct tests for the Paginator, in addition to the tests for the ItemPaginator.

@codecov
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.18%. Comparing base (1b2652c) to head (d42c14f).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1703      +/-   ##
==========================================
- Coverage   96.23%   96.18%   -0.05%     
==========================================
  Files          49       48       -1     
  Lines        1857     1809      -48     
==========================================
- Hits         1787     1740      -47     
+ Misses         70       69       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbolduc dbolduc marked this pull request as ready for review April 3, 2025 21:36
@dbolduc dbolduc merged commit 04a6a67 into googleapis:main Apr 4, 2025
21 checks passed
@dbolduc dbolduc deleted the test-pagination branch April 4, 2025 13:21
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