diff options
author | Zuul <zuul@review.opendev.org> | 2022-06-06 21:32:55 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-06-06 21:32:55 +0000 |
commit | 1d28cc6f7231ed866b432174affd1d796ca8cb23 (patch) | |
tree | a6c87f88e880d3bcddc7b876b2c4e46a6bef5490 | |
parent | 33d82f8b72952de65a053f12c0f1e4718f590d01 (diff) | |
parent | 3e7535543923a1129a7a81ea38c8db75da86c713 (diff) | |
download | designate-1d28cc6f7231ed866b432174affd1d796ca8cb23.tar.gz |
Merge "Minimum TTL value allowed is zero" into stable/wallaby
4 files changed, 15 insertions, 7 deletions
diff --git a/designate/objects/zone.py b/designate/objects/zone.py index 3b9e54dc..45fa2a11 100644 --- a/designate/objects/zone.py +++ b/designate/objects/zone.py @@ -31,7 +31,7 @@ class Zone(base.DesignateObject, base.DictObjectMixin, 'tenant_id': fields.StringFields(nullable=True, read_only=False), 'name': fields.DomainField(maxLength=255), 'email': fields.EmailField(maxLength=255, nullable=True), - 'ttl': fields.IntegerFields(nullable=True, minimum=1, + 'ttl': fields.IntegerFields(nullable=True, minimum=0, maximum=2147483647), 'refresh': fields.IntegerFields(nullable=True, minimum=0, maximum=2147483647, read_only=False), diff --git a/designate/tests/test_api/test_v2/test_zones.py b/designate/tests/test_api/test_v2/test_zones.py index e9d1c386..e3c4f881 100644 --- a/designate/tests/test_api/test_v2/test_zones.py +++ b/designate/tests/test_api/test_v2/test_zones.py @@ -139,8 +139,8 @@ class ApiV2ZonesTest(ApiV2TestCase): fixture = self.get_zone_fixture(fixture=0) fixture['ttl'] = 0 body = fixture - self._assert_exception('invalid_object', 400, self.client.post_json, - '/zones', body) + response = self.client.post_json('/zones', body) + self.assertEqual(202, response.status_int) def test_create_zone_ttl_is_greater_than_max(self): fixture = self.get_zone_fixture(fixture=0) diff --git a/designate/tests/test_central/test_service.py b/designate/tests/test_central/test_service.py index f2f8eb11..ec62354a 100644 --- a/designate/tests/test_central/test_service.py +++ b/designate/tests/test_central/test_service.py @@ -718,18 +718,18 @@ class CentralServiceTest(CentralTestCase): self.policy({'use_low_ttl': '!'}) self.config(min_ttl=100, group='service:central') - context = self.get_context() + context = self.get_context(project_id=1) values = self.get_zone_fixture(fixture=1) - values['ttl'] = 0 + values['ttl'] = 5 - with testtools.ExpectedException(ValueError): + with testtools.ExpectedException(exceptions.InvalidTTL): self.central_service.create_zone( context, objects.Zone.from_dict(values)) def test_create_zone_below_zero_ttl(self): self.policy({'use_low_ttl': '!'}) - self.config(min_ttl=1, + self.config(min_ttl=0, group='service:central') context = self.get_context() diff --git a/releasenotes/notes/bug-1926429-allow-ttl-min-of-zero-688f7c2cf095d89d.yaml b/releasenotes/notes/bug-1926429-allow-ttl-min-of-zero-688f7c2cf095d89d.yaml new file mode 100644 index 00000000..fc157bde --- /dev/null +++ b/releasenotes/notes/bug-1926429-allow-ttl-min-of-zero-688f7c2cf095d89d.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Allows for a minimum TTL value of zero to be used instead of 1. As stated + in RFC https://datatracker.ietf.org/doc/html/rfc2181#section-8. + + .. _bug 1926429: https://bugs.launchpad.net/designate/+bug/1926429 + |