From: Peter van Dijk Date: Tue, 27 Nov 2018 14:52:11 +0000 (+0100) Subject: fix rrset sorting X-Git-Tag: auth-4.2.0-alpha1~24^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d4c592e2b25a48d4412b411613ceeb054962f7a;p=pdns fix rrset sorting --- diff --git a/regression-tests.auth-py/authtests.py b/regression-tests.auth-py/authtests.py index c680a82dc..61073234e 100644 --- a/regression-tests.auth-py/authtests.py +++ b/regression-tests.auth-py/authtests.py @@ -413,6 +413,13 @@ distributor-threads=1""".format(confdir=confdir, prefix=cls._PREFIX, if not found : raise AssertionError("RRset not found in answer\n\n%s" % ret) + def sortRRsets(self, rrsets): + """Sorts RRsets in a more useful way than dnspython's default behaviour + + @param rrsets: an array of dns.rrset.RRset objects""" + + return sorted(rrsets, key=lambda rrset: (rrset.name, rrset.rdtype)) + def assertAnyRRsetInAnswer(self, msg, rrsets): """Asserts that any of the supplied rrsets exists (without comparing TTL) in the answer section of msg diff --git a/regression-tests.auth-py/test_LuaRecords.py b/regression-tests.auth-py/test_LuaRecords.py index 1a5e41aa9..693ae879c 100644 --- a/regression-tests.auth-py/test_LuaRecords.py +++ b/regression-tests.auth-py/test_LuaRecords.py @@ -559,7 +559,7 @@ any IN TXT "hello there" res = self.sendUDPQuery(query) self.assertRcodeEqual(res, dns.rcode.NOERROR) - self.assertEqual(sorted(res.answer), sorted(response.answer)) + self.assertEqual(self.sortRRsets(res.answer), self.sortRRsets(response.answer)) if __name__ == '__main__': unittest.main()