Expose a bug that list_limit doesn't work correctly
The list_limit for domain list doesn't work correctly. The return count will less than list_limit if the sql query contains root domain This patch expose this bug and it will be fixed in the following patch. Co-Authored-By: Lance Bragstad<lbragstad@gmail.com> Partial-bug: #1760521 Change-Id: Ib28793c97f1b730cb3b83b046e653a7b660af875
This commit is contained in:
parent
a6adc72e3e
commit
c522fc3bb7
@ -24,6 +24,7 @@ from keystone import exception
|
||||
from keystone.tests import unit
|
||||
from keystone.tests.unit import default_fixtures
|
||||
from keystone.tests.unit import filtering
|
||||
from keystone.tests.unit import utils as test_utils
|
||||
|
||||
|
||||
CONF = keystone.conf.CONF
|
||||
@ -1105,6 +1106,36 @@ class IdentityTests(object):
|
||||
self.assertThat(entities[1]['name'],
|
||||
matchers.StartsWith('domaingroup1'))
|
||||
|
||||
@unit.skip_if_no_multiple_domains_support
|
||||
@test_utils.wip('The root domain throws off the limit count by one',
|
||||
bug='#1760521')
|
||||
def test_list_limit_for_domains(self):
|
||||
def create_domains(count):
|
||||
for _ in range(count):
|
||||
domain = unit.new_domain_ref()
|
||||
self.domain_list.append(
|
||||
PROVIDERS.resource_api.create_domain(domain['id'], domain))
|
||||
|
||||
def clean_up_domains():
|
||||
for domain in self.domain_list:
|
||||
PROVIDERS.resource_api.update_domain(
|
||||
domain['id'], {'enabled': False})
|
||||
PROVIDERS.resource_api.delete_domain(domain['id'])
|
||||
|
||||
PROVIDERS.resource_api.create_domain(
|
||||
default_fixtures.ROOT_DOMAIN['id'], default_fixtures.ROOT_DOMAIN
|
||||
)
|
||||
|
||||
self.domain_list = []
|
||||
create_domains(6)
|
||||
self.addCleanup(clean_up_domains)
|
||||
|
||||
for x in range(1, 7):
|
||||
self.config_fixture.config(group='resource', list_limit=x)
|
||||
hints = driver_hints.Hints()
|
||||
entities = PROVIDERS.resource_api.list_domains(hints=hints)
|
||||
self.assertThat(entities, matchers.HasLength(hints.limit['limit']))
|
||||
|
||||
|
||||
class FilterTests(filtering.FilterTests):
|
||||
def test_list_entities_filtered(self):
|
||||
|
@ -3044,6 +3044,12 @@ class DomainSpecificLDAPandSQLIdentity(
|
||||
self.skip_test_overrides(
|
||||
'Restricted multi LDAP class does not support multiple domains')
|
||||
|
||||
def test_list_limit_for_domains(self):
|
||||
# With this restricted multi LDAP class, tests that use multiple
|
||||
# domains and identity, are still not supported
|
||||
self.skip_test_overrides(
|
||||
'Restricted multi LDAP class does not support multiple domains')
|
||||
|
||||
|
||||
class DomainSpecificSQLIdentity(DomainSpecificLDAPandSQLIdentity):
|
||||
"""Class to test simplest use of domain-specific SQL driver.
|
||||
|
@ -21,6 +21,7 @@ import keystone.conf
|
||||
from keystone.credential.providers import fernet as credential_fernet
|
||||
from keystone import exception
|
||||
from keystone.tests import unit
|
||||
from keystone.tests.unit import default_fixtures
|
||||
from keystone.tests.unit import ksfixtures
|
||||
from keystone.tests.unit import test_v3
|
||||
from keystone.tests.unit import utils as test_utils
|
||||
@ -150,6 +151,25 @@ class ResourceTestCase(test_v3.RestfulTestCase,
|
||||
resource_url=resource_url)
|
||||
self.head(resource_url, expected_status=http_client.OK)
|
||||
|
||||
@test_utils.wip('The root domain throws off the limit count by one',
|
||||
bug='#1760521')
|
||||
def test_list_limit_for_domains(self):
|
||||
PROVIDERS.resource_api.create_domain(
|
||||
default_fixtures.ROOT_DOMAIN['id'], default_fixtures.ROOT_DOMAIN
|
||||
)
|
||||
|
||||
for x in range(6):
|
||||
domain = {'domain': unit.new_domain_ref()}
|
||||
self.post('/domains', body=domain)
|
||||
|
||||
for expected_length in range(1, 6):
|
||||
self.config_fixture.config(
|
||||
group='resource', list_limit=expected_length
|
||||
)
|
||||
response = self.get('/domains')
|
||||
domain_list = response.json_body['domains']
|
||||
self.assertEqual(expected_length, len(domain_list))
|
||||
|
||||
def test_get_head_domain(self):
|
||||
"""Call ``GET /domains/{domain_id}``."""
|
||||
resource_url = '/domains/%(domain_id)s' % {
|
||||
|
Loading…
x
Reference in New Issue
Block a user