From: Xabier Napal Date: Tue, 21 Oct 2025 06:51:25 +0000 (+0200) Subject: test(auth): add empty backupselector test case X-Git-Tag: rec-5.4.0-beta1~83^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31584c6847533ce5cd650b5530825ddd5979f1b5;p=thirdparty%2Fpdns.git test(auth): add empty backupselector test case Signed-off-by: Xabier Napal --- diff --git a/regression-tests.auth-py/test_LuaRecords.py b/regression-tests.auth-py/test_LuaRecords.py index b0131e1f5d..8873685330 100644 --- a/regression-tests.auth-py/test_LuaRecords.py +++ b/regression-tests.auth-py/test_LuaRecords.py @@ -65,6 +65,7 @@ some.ifportup 3600 IN LUA A "ifportup(8080, {{'192.168.42.21 multi.ifportup 3600 IN LUA A "ifportup(8080, {{ {{'192.168.42.23'}}, {{'192.168.42.21', '{prefix}.102'}}, {{'{prefix}.101'}} }})" none.ifportup 3600 IN LUA A "ifportup(8080, {{'192.168.42.21', '192.168.21.42'}})" all.noneup.ifportup 3600 IN LUA A "ifportup(8080, {{'192.168.42.21', '192.168.21.42'}}, {{ backupSelector='all' }})" +empty.ifportup 3600 IN LUA A "ifportup(8080, {{'192.168.42.21', '192.168.21.42'}}, {{ backupSelector='empty' }})" hashed.example.org. 3600 IN LUA A "pickhashed({{ '1.2.3.4', '4.3.2.1' }})" hashed-v6.example.org. 3600 IN LUA AAAA "pickhashed({{ '2001:db8:a0b:12f0::1', 'fe80::2a1:9bff:fe9b:f268' }})" @@ -443,6 +444,19 @@ class TestLuaRecords(BaseLuaTest): self.assertRcodeEqual(res, dns.rcode.NOERROR) self.assertEqual(res.answer, expected) + def testIfportupWithAllDownAndEmptyBackupSelector(self): + """ + Basic ifportup() test with all ports DOWN, fallback to 'empty' backup selector + """ + name = 'empty.ifportup.example.org.' + query = dns.message.make_query(name, dns.rdatatype.A) + + # With backupSelector='empty', we always return NODATA when no healthy targets, + # even before health checks have run (fail-close behavior). + res = self.sendUDPQuery(query) + self.assertRcodeEqual(res, dns.rcode.NOERROR) + self.assertEqual(res.answer, []) + def testIfurlup(self): """ Basic ifurlup() test