From 32cc7e7acd6ba6e602d2dd58c5ac2facb24fbb54 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Wed, 21 Jan 2026 15:14:48 +0100 Subject: [PATCH] Add a test for EXTEND adding a record with mismatching TTL. Signed-off-by: Miod Vallat --- regression-tests.api/test_Zones.py | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/regression-tests.api/test_Zones.py b/regression-tests.api/test_Zones.py index 25db863a3e..bd1642257a 100644 --- a/regression-tests.api/test_Zones.py +++ b/regression-tests.api/test_Zones.py @@ -1677,6 +1677,48 @@ $NAME$ 1D IN SOA ns1.example.org. hostmaster.example.org. ( data2 = self.get_zone(name) self.assertEqual(get_rrset(data, 'a.'+name), get_rrset(data2, 'a.'+name)) + def test_zone_rr_bogus_extend(self): + name, payload, zone = self.create_zone() + # add a single record with extend + rrset = { + 'changetype': 'extend', + 'name': 'txt.'+name, + 'type': 'TXT', + 'ttl': 3600, + 'records': [ + { + "content": "\"hello\"", + "disabled": False + } + ] + } + payload = {'rrsets': [rrset]} + r = self.session.patch( + self.url("/api/v1/servers/localhost/zones/" + name), + data=json.dumps(payload), + headers={'content-type': 'application/json'}) + self.assert_success(r) + # try and add another record with a mismatching ttl + rrset2 = { + 'changetype': 'extend', + 'name': 'txt.'+name, + 'type': 'TXT', + 'ttl': 1234, + 'records': [ + { + "content": "\"hello again\"", + "disabled": False + } + ] + } + payload2 = {'rrsets': [rrset2]} + r = self.session.patch( + self.url("/api/v1/servers/localhost/zones/" + name), + data=json.dumps(payload2), + headers={'content-type': 'application/json'}) + self.assertEqual(r.status_code, 422) + self.assert_in_json_error('uses a different TTL value than the remainder of the RRset', r.json()) + def test_zone_rr_update_with_prune(self): name, payload, zone = self.create_zone() # fill a bunch of records -- 2.47.3