Resource permissions: Make sure that list response includes the next page token (#111446)
make sure that list iterator returns a next page token
This commit is contained in:
@@ -95,7 +95,7 @@ func (s *ResourcePermSqlBackend) ListIterator(ctx context.Context, req *resource
|
||||
}
|
||||
|
||||
pagination := &common.Pagination{
|
||||
Limit: limit,
|
||||
Limit: limit + 1, // fetch one more to determine if there is a next page
|
||||
Continue: token.offset,
|
||||
}
|
||||
|
||||
|
||||
@@ -580,6 +580,9 @@ func TestIntegration_ResourcePermSqlBackend_ListIterator(t *testing.T) {
|
||||
continueToken = it.ContinueToken()
|
||||
require.NoError(t, json.Unmarshal(it.Value(), &perm))
|
||||
results = append(results, perm.Name)
|
||||
if len(results) >= int(req.Limit) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@@ -591,6 +594,9 @@ func TestIntegration_ResourcePermSqlBackend_ListIterator(t *testing.T) {
|
||||
continueToken = it.ContinueToken()
|
||||
require.NoError(t, json.Unmarshal(it.Value(), &perm))
|
||||
results = append(results, perm.Name)
|
||||
if len(results) >= int(req.Limit) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@@ -603,6 +609,9 @@ func TestIntegration_ResourcePermSqlBackend_ListIterator(t *testing.T) {
|
||||
continueToken = it.ContinueToken()
|
||||
require.NoError(t, json.Unmarshal(it.Value(), &perm))
|
||||
results = append(results, perm.Name)
|
||||
if len(results) >= int(req.Limit) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user