From: Miod Vallat Date: Wed, 21 Jan 2026 14:14:48 +0000 (+0100) Subject: Add a test for EXTEND adding a record with mismatching TTL. X-Git-Tag: rec-5.4.0-beta1~17^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16753%2Fhead;p=thirdparty%2Fpdns.git Add a test for EXTEND adding a record with mismatching TTL. Signed-off-by: Miod Vallat --- 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