Add basic storage test to test config overrides
Basic test coverage for overriding the default_ttl for zone creation. Change-Id: Ic977f8c3986a0c24d43db1f3899a508620096c03
This commit is contained in:
parent
aae83d09b8
commit
12362a234f
@ -533,6 +533,37 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
|
||||
self.assertEqual(exceptions.OverQuota, exc.exc_info[0])
|
||||
|
||||
def test_create_zone_custom_ttl(self):
|
||||
self.config(default_ttl=30)
|
||||
|
||||
values = dict(
|
||||
name='example.com.',
|
||||
email='info@example.com',
|
||||
type='PRIMARY',
|
||||
ttl=90,
|
||||
)
|
||||
|
||||
zone = self.central_service.create_zone(
|
||||
self.admin_context, zone=objects.Zone.from_dict(values)
|
||||
)
|
||||
|
||||
self.assertEqual(90, zone.ttl)
|
||||
|
||||
def test_create_zone_override_default_ttl(self):
|
||||
self.config(default_ttl=30)
|
||||
|
||||
values = dict(
|
||||
name='example.com.',
|
||||
email='info@example.com',
|
||||
type='PRIMARY'
|
||||
)
|
||||
|
||||
zone = self.central_service.create_zone(
|
||||
self.admin_context, zone=objects.Zone.from_dict(values)
|
||||
)
|
||||
|
||||
self.assertEqual(30, zone.ttl)
|
||||
|
||||
def test_create_subzone(self):
|
||||
# Create the Parent Zone using fixture 0
|
||||
parent_zone = self.create_zone(fixture=0)
|
||||
|
@ -683,6 +683,36 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
self.assertEqual(exceptions.DuplicateZone, exc.exc_info[0])
|
||||
|
||||
def test_create_zone_standard_ttl(self):
|
||||
values = self.get_zone_fixture()
|
||||
new_zone = self.storage.create_zone(
|
||||
self.admin_context, zone=objects.Zone.from_dict(values)
|
||||
)
|
||||
|
||||
# default fallback ttl is 3600 when no ttl value is provided.
|
||||
self.assertEqual(3600, new_zone.ttl)
|
||||
|
||||
def test_create_zone_custom_ttl(self):
|
||||
self.config(default_ttl=60)
|
||||
|
||||
values = self.get_zone_fixture()
|
||||
values['ttl'] = 30
|
||||
new_zone = self.storage.create_zone(
|
||||
self.admin_context, zone=objects.Zone.from_dict(values)
|
||||
)
|
||||
|
||||
self.assertEqual(30, new_zone.ttl)
|
||||
|
||||
def test_create_zone_override_default_ttl(self):
|
||||
self.config(default_ttl=60)
|
||||
|
||||
values = self.get_zone_fixture()
|
||||
new_zone = self.storage.create_zone(
|
||||
self.admin_context, zone=objects.Zone.from_dict(values)
|
||||
)
|
||||
|
||||
self.assertEqual(60, new_zone.ttl)
|
||||
|
||||
def test_find_zones(self):
|
||||
self.config(quota_zones=20)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user