From: Miod Vallat Date: Fri, 18 Jul 2025 10:18:39 +0000 (+0200) Subject: Check that timestamp exist and increase if LMDB. X-Git-Tag: rec-5.4.0-alpha0~9^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F15867%2Fhead;p=thirdparty%2Fpdns.git Check that timestamp exist and increase if LMDB. Signed-off-by: Miod Vallat --- diff --git a/regression-tests.api/test_Zones.py b/regression-tests.api/test_Zones.py index b85016160..097faf881 100644 --- a/regression-tests.api/test_Zones.py +++ b/regression-tests.api/test_Zones.py @@ -2554,6 +2554,41 @@ $NAME$ 1D IN SOA ns1.example.org. hostmaster.example.org. ( rrsets = base_rrsets + templated_rrsets(invalid_rrsets, name) self.put_zone(name, {'rrsets': rrsets}, expect_error=expected_error) + @unittest.skipIf(not is_auth_lmdb(), "No rrset timestamps except with LMDB") + def test_check_rrset_modified_at(self): + name = 'host-18000.example.com.' + r = self.session.get(self.url("/api/v1/servers/localhost/zones")) + domains = r.json() + example_com = [domain for domain in domains if domain['name'] == u'example.com.'][0] + + # verify single record from name that has a single record + data = self.get_zone(example_com['id'], rrset_name="host-18000.example.com.") + modified_at = data['rrsets'][0]['records'][0]['modified_at'] + + # write back the same data anyway, to get a new timestamp + rrset = { + 'changetype': 'replace', + 'name': name, + 'type': 'A', + 'ttl': 120, + 'records': + [ + { + 'content': '192.168.1.80', + } + ] + } + payload = {'rrsets': [rrset]} + r = self.session.patch( + self.url("/api/v1/servers/localhost/zones/example.com"), + data=json.dumps(payload), + headers={'content-type': 'application/json'}) + self.assert_success(r) + + # get the changed record. + data = self.get_zone(example_com['id'], rrset_name="host-18000.example.com.") + modified_at_new = data['rrsets'][0]['records'][0]['modified_at'] + self.assertGreater(modified_at_new, modified_at) @unittest.skipIf(not is_auth(), "Not applicable") class AuthRootZone(ApiTestCase, AuthZonesHelperMixin):