Skip to content

List operations do not return nextPageToken which prevents proper paging #665

Description

@mderka

When implementing integration tests for DNS, I noticed that if one restricts the fields to be retrieved for a list operation, iterateAll() does not work properly. The following test would always fail:

dnsRecordIterator = DNS.listDnsRecords(zone.name(),
    Dns.DnsRecordListOption.fields(Dns.DnsRecordField.TYPE),
    Dns.DnsRecordListOption.pageSize(1)).iterateAll(); // to force the iterator fetch next page
  int counter = 0;
  while (dnsRecordIterator.hasNext()) {
    counter++;
  }
assertEquals(2, counter);

This is because the field selector silently prevents the service from returning the nextPageToken:

builder.append("rrsets(").append(DnsRecordField.selector(fields)).append(')');

instead of

builder.append("nextPageToken,rrsets(").append(DnsRecordField.selector(fields)).append(')');

I recall seeing the same handling in resource manage. Having discussed this with @ajkannan, this is likely a bug. The same bug may be present in other parts of the library when a combination of listing and field restriction is possible.

Activity

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

Metadata

Metadata

Assignees

Labels

api: cloudresourcemanagerIssues related to the Resource Manager API.api: storageIssues related to the Cloud Storage API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions