From d3ec24f94073d16dafbbf36e315786aa8260cb60 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Wed, 10 Apr 2019 22:03:47 +0200 Subject: [PATCH] update tests to new naming --- .../test-include-dir/test.conf | 2 +- regression-tests.dnsdist/test_Advanced.py | 18 +++++++++--------- regression-tests.dnsdist/test_Basics.py | 12 ++++++------ regression-tests.dnsdist/test_Caching.py | 6 +++--- regression-tests.dnsdist/test_CheckConfig.py | 6 +++--- regression-tests.dnsdist/test_Dnstap.py | 2 +- regression-tests.dnsdist/test_DynBlocks.py | 2 +- .../test_EDNSSelfGenerated.py | 4 ++-- regression-tests.dnsdist/test_HealthChecks.py | 2 +- regression-tests.dnsdist/test_Protobuf.py | 2 +- regression-tests.dnsdist/test_RecordsCount.py | 8 ++++---- regression-tests.dnsdist/test_Responses.py | 6 +++--- regression-tests.dnsdist/test_TCPKeepAlive.py | 2 +- regression-tests.dnsdist/test_TeeAction.py | 4 ++-- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/regression-tests.dnsdist/test-include-dir/test.conf b/regression-tests.dnsdist/test-include-dir/test.conf index 0b358ca7e..01bc901ba 100644 --- a/regression-tests.dnsdist/test-include-dir/test.conf +++ b/regression-tests.dnsdist/test-include-dir/test.conf @@ -1 +1 @@ -addAction(AllRule(), RCodeAction(dnsdist.REFUSED)) +addAction(AllRule(), RCodeAction(DNSRCode.REFUSED)) diff --git a/regression-tests.dnsdist/test_Advanced.py b/regression-tests.dnsdist/test_Advanced.py index 78105512e..4a4c7e555 100644 --- a/regression-tests.dnsdist/test_Advanced.py +++ b/regression-tests.dnsdist/test_Advanced.py @@ -452,7 +452,7 @@ class TestAdvancedTruncateAnyAndTCP(DNSDistTest): class TestAdvancedAndNot(DNSDistTest): _config_template = """ - addAction(AndRule({NotRule(QTypeRule("A")), TCPRule(false)}), RCodeAction(dnsdist.NOTIMP)) + addAction(AndRule({NotRule(QTypeRule("A")), TCPRule(false)}), RCodeAction(DNSRCode.NOTIMP)) newServer{address="127.0.0.1:%s"} """ def testAOverUDPReturnsNotImplementedCanary(self): @@ -519,7 +519,7 @@ class TestAdvancedAndNot(DNSDistTest): class TestAdvancedOr(DNSDistTest): _config_template = """ - addAction(OrRule({QTypeRule("A"), TCPRule(false)}), RCodeAction(dnsdist.NOTIMP)) + addAction(OrRule({QTypeRule("A"), TCPRule(false)}), RCodeAction(DNSRCode.NOTIMP)) newServer{address="127.0.0.1:%s"} """ def testAAAAOverUDPReturnsNotImplemented(self): @@ -885,7 +885,7 @@ class TestAdvancedQPSNone(DNSDistTest): _config_template = """ addAction("qpsnone.advanced.tests.powerdns.com", QPSAction(100)) - addAction(AllRule(), RCodeAction(dnsdist.REFUSED)) + addAction(AllRule(), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -912,7 +912,7 @@ class TestAdvancedNMGRule(DNSDistTest): _config_template = """ allowed = newNMG() allowed:addMask("192.0.2.1/32") - addAction(NotRule(NetmaskGroupRule(allowed)), RCodeAction(dnsdist.REFUSED)) + addAction(NotRule(NetmaskGroupRule(allowed)), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -937,7 +937,7 @@ class TestDSTPortRule(DNSDistTest): _config_params = ['_dnsDistPort', '_testServerPort'] _config_template = """ - addAction(DSTPortRule(%d), RCodeAction(dnsdist.REFUSED)) + addAction(DSTPortRule(%d), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -962,7 +962,7 @@ class TestDSTPortRule(DNSDistTest): class TestAdvancedLabelsCountRule(DNSDistTest): _config_template = """ - addAction(QNameLabelsCountRule(5,6), RCodeAction(dnsdist.REFUSED)) + addAction(QNameLabelsCountRule(5,6), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -1015,7 +1015,7 @@ class TestAdvancedLabelsCountRule(DNSDistTest): class TestAdvancedWireLengthRule(DNSDistTest): _config_template = """ - addAction(QNameWireLengthRule(54,56), RCodeAction(dnsdist.REFUSED)) + addAction(QNameWireLengthRule(54,56), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -1351,7 +1351,7 @@ com.""") class TestAdvancedRD(DNSDistTest): _config_template = """ - addAction(RDRule(), RCodeAction(dnsdist.REFUSED)) + addAction(RDRule(), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -1654,7 +1654,7 @@ class TestAdvancedEDNSVersionRule(DNSDistTest): _config_template = """ newServer{address="127.0.0.1:%s"} - addAction(EDNSVersionRule(0), ERCodeAction(dnsdist.BADVERS)) + addAction(EDNSVersionRule(0), ERCodeAction(DNSRCode.BADVERS)) """ def testDropped(self): diff --git a/regression-tests.dnsdist/test_Basics.py b/regression-tests.dnsdist/test_Basics.py index 4ecdb096e..5dfda57d2 100644 --- a/regression-tests.dnsdist/test_Basics.py +++ b/regression-tests.dnsdist/test_Basics.py @@ -9,15 +9,15 @@ class TestBasics(DNSDistTest): _config_template = """ newServer{address="127.0.0.1:%s"} truncateTC(true) - addAction(AndRule{QTypeRule(dnsdist.ANY), TCPRule(false)}, TCAction()) - addAction(RegexRule("evil[0-9]{4,}\\\\.regex\\\\.tests\\\\.powerdns\\\\.com$"), RCodeAction(dnsdist.REFUSED)) + addAction(AndRule{QTypeRule(DNSQType.ANY), TCPRule(false)}, TCAction()) + addAction(RegexRule("evil[0-9]{4,}\\\\.regex\\\\.tests\\\\.powerdns\\\\.com$"), RCodeAction(DNSRCode.REFUSED)) mySMN = newSuffixMatchNode() mySMN:add(newDNSName("nameAndQtype.tests.powerdns.com.")) - addAction(AndRule{SuffixMatchNodeRule(mySMN), QTypeRule("TXT")}, RCodeAction(dnsdist.NOTIMP)) + addAction(AndRule{SuffixMatchNodeRule(mySMN), QTypeRule("TXT")}, RCodeAction(DNSRCode.NOTIMP)) addAction(makeRule("drop.test.powerdns.com."), DropAction()) - addAction(AndRule({QTypeRule(dnsdist.A),QNameRule("ds9a.nl")}), SpoofAction("1.2.3.4")) - addAction(newDNSName("dnsname.addaction.powerdns.com."), RCodeAction(dnsdist.REFUSED)) - addAction({newDNSName("dnsname-table1.addaction.powerdns.com."), newDNSName("dnsname-table2.addaction.powerdns.com.")}, RCodeAction(dnsdist.REFUSED)) + addAction(AndRule({QTypeRule(DNSQType.A),QNameRule("ds9a.nl")}), SpoofAction("1.2.3.4")) + addAction(newDNSName("dnsname.addaction.powerdns.com."), RCodeAction(DNSRCode.REFUSED)) + addAction({newDNSName("dnsname-table1.addaction.powerdns.com."), newDNSName("dnsname-table2.addaction.powerdns.com.")}, RCodeAction(DNSRCode.REFUSED)) """ def testDropped(self): diff --git a/regression-tests.dnsdist/test_Caching.py b/regression-tests.dnsdist/test_Caching.py index 60a898b65..aba9d554b 100644 --- a/regression-tests.dnsdist/test_Caching.py +++ b/regression-tests.dnsdist/test_Caching.py @@ -1038,7 +1038,7 @@ class TestCacheManagement(DNSDistTest): self.assertEquals(receivedResponse, response2) # remove cached entries from name A - self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"" + name + "\"), dnsdist.A)") + self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"" + name + "\"), DNSQType.A)") # Miss for name A (receivedQuery, receivedResponse) = self.sendUDPQuery(query, response) @@ -1119,7 +1119,7 @@ class TestCacheManagement(DNSDistTest): self.assertEquals(receivedResponse, response2) # remove cached entries from name - self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"suffix.cache.tests.powerdns.com.\"), dnsdist.ANY, true)") + self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"suffix.cache.tests.powerdns.com.\"), DNSQType.ANY, true)") # Miss for name (receivedQuery, receivedResponse) = self.sendUDPQuery(query, response) @@ -1200,7 +1200,7 @@ class TestCacheManagement(DNSDistTest): self.assertEquals(receivedResponse, response2) # remove cached entries from name A - self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"suffixtype.cache.tests.powerdns.com.\"), dnsdist.A, true)") + self.sendConsoleCommand("getPool(\"\"):getCache():expungeByName(newDNSName(\"suffixtype.cache.tests.powerdns.com.\"), DNSQType.A, true)") # Miss for name A (receivedQuery, receivedResponse) = self.sendUDPQuery(query, response) diff --git a/regression-tests.dnsdist/test_CheckConfig.py b/regression-tests.dnsdist/test_CheckConfig.py index ba3befb18..ce9345c05 100644 --- a/regression-tests.dnsdist/test_CheckConfig.py +++ b/regression-tests.dnsdist/test_CheckConfig.py @@ -33,11 +33,11 @@ class TestCheckConfig(unittest.TestCase): configTemplate = """ newServer{address="127.0.0.1:53"} truncateTC(true) - addAction(AndRule{QTypeRule(dnsdist.ANY), TCPRule(false)}, TCAction()) - addAction(RegexRule("evil[0-9]{4,}\\\\.regex\\\\.tests\\\\.powerdns\\\\.com$"), RCodeAction(dnsdist.REFUSED)) + addAction(AndRule{QTypeRule(DNSQType.ANY), TCPRule(false)}, TCAction()) + addAction(RegexRule("evil[0-9]{4,}\\\\.regex\\\\.tests\\\\.powerdns\\\\.com$"), RCodeAction(DNSRCode.REFUSED)) mySMN = newSuffixMatchNode() mySMN:add(newDNSName("nameAndQtype.tests.powerdns.com.")) - addAction(AndRule{SuffixMatchNodeRule(mySMN), QTypeRule("TXT")}, RCodeAction(dnsdist.NOTIMP)) + addAction(AndRule{SuffixMatchNodeRule(mySMN), QTypeRule("TXT")}, RCodeAction(DNSRCode.NOTIMP)) addAction(makeRule("drop.test.powerdns.com."), DropAction()) """ diff --git a/regression-tests.dnsdist/test_Dnstap.py b/regression-tests.dnsdist/test_Dnstap.py index 78e71bffc..f91647e7b 100644 --- a/regression-tests.dnsdist/test_Dnstap.py +++ b/regression-tests.dnsdist/test_Dnstap.py @@ -102,7 +102,7 @@ class TestDnstapOverRemoteLogger(DNSDistTest): function luaFunc(dq) dq.dh:setQR(true) - dq.dh:setRCode(dnsdist.NXDOMAIN) + dq.dh:setRCode(DNSRCode.NXDOMAIN) return DNSAction.None, "" end diff --git a/regression-tests.dnsdist/test_DynBlocks.py b/regression-tests.dnsdist/test_DynBlocks.py index a5768b5fb..062603574 100644 --- a/regression-tests.dnsdist/test_DynBlocks.py +++ b/regression-tests.dnsdist/test_DynBlocks.py @@ -803,7 +803,7 @@ class TestDynBlockGroupServFails(DynBlocksTest): _config_params = ['_dynBlockQPS', '_dynBlockPeriod', '_dynBlockDuration', '_testServerPort'] _config_template = """ local dbr = dynBlockRulesGroup() - dbr:setRCodeRate(dnsdist.SERVFAIL, %d, %d, "Exceeded query rate", %d) + dbr:setRCodeRate(DNSRCode.SERVFAIL, %d, %d, "Exceeded query rate", %d) function maintenance() dbr:apply() diff --git a/regression-tests.dnsdist/test_EDNSSelfGenerated.py b/regression-tests.dnsdist/test_EDNSSelfGenerated.py index c1d7c56f2..c5cb99bd7 100644 --- a/regression-tests.dnsdist/test_EDNSSelfGenerated.py +++ b/regression-tests.dnsdist/test_EDNSSelfGenerated.py @@ -11,7 +11,7 @@ class TestEDNSSelfGenerated(DNSDistTest): """ _config_template = """ - addAction("rcode.edns-self.tests.powerdns.com.", RCodeAction(dnsdist.REFUSED)) + addAction("rcode.edns-self.tests.powerdns.com.", RCodeAction(DNSRCode.REFUSED)) addAction("tc.edns-self.tests.powerdns.com.", TCAction()) function luarule(dq) @@ -262,7 +262,7 @@ class TestEDNSSelfGeneratedDisabled(DNSDistTest): _config_template = """ setAddEDNSToSelfGeneratedResponses(false) - addAction("rcode.edns-self-disabled.tests.powerdns.com.", RCodeAction(dnsdist.REFUSED)) + addAction("rcode.edns-self-disabled.tests.powerdns.com.", RCodeAction(DNSRCode.REFUSED)) addAction("tc.edns-self-disabled.tests.powerdns.com.", TCAction()) function luarule(dq) diff --git a/regression-tests.dnsdist/test_HealthChecks.py b/regression-tests.dnsdist/test_HealthChecks.py index 8e25488c0..efccf206f 100644 --- a/regression-tests.dnsdist/test_HealthChecks.py +++ b/regression-tests.dnsdist/test_HealthChecks.py @@ -163,7 +163,7 @@ class TestHealthCheckCustomFunction(HealthCheckTest): function myHealthCheckFunction(qname, qtype, qclass, dh) dh:setCD(true) - return newDNSName('powerdns.com.'), dnsdist.AAAA, qclass + return newDNSName('powerdns.com.'), DNSQType.AAAA, qclass end srv = newServer{address="127.0.0.1:%d", checkName='powerdns.org.', checkFunction=myHealthCheckFunction} diff --git a/regression-tests.dnsdist/test_Protobuf.py b/regression-tests.dnsdist/test_Protobuf.py index d7bacbb63..c780389d7 100644 --- a/regression-tests.dnsdist/test_Protobuf.py +++ b/regression-tests.dnsdist/test_Protobuf.py @@ -198,7 +198,7 @@ class TestProtobuf(DNSDistProtobufTest): protobuf:setTagArray(tablePB) -- store table in protobuf protobuf:setTag("Query,123") -- add another tag entry in protobuf - protobuf:setResponseCode(dnsdist.NXDOMAIN) -- set protobuf response code to be NXDOMAIN + protobuf:setResponseCode(DNSRCode.NXDOMAIN) -- set protobuf response code to be NXDOMAIN local strReqName = dq.qname:toString() -- get request dns name diff --git a/regression-tests.dnsdist/test_RecordsCount.py b/regression-tests.dnsdist/test_RecordsCount.py index 4b9ce8b27..1abe575fd 100644 --- a/regression-tests.dnsdist/test_RecordsCount.py +++ b/regression-tests.dnsdist/test_RecordsCount.py @@ -7,7 +7,7 @@ from dnsdisttests import DNSDistTest class TestRecordsCountOnlyOneAR(DNSDistTest): _config_template = """ - addAction(NotRule(RecordsCountRule(DNSSection.Additional, 1, 1)), RCodeAction(dnsdist.REFUSED)) + addAction(NotRule(RecordsCountRule(DNSSection.Additional, 1, 1)), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -79,7 +79,7 @@ class TestRecordsCountMoreThanOneLessThanFour(DNSDistTest): _config_template = """ addAction(RecordsCountRule(DNSSection.Answer, 2, 3), AllowAction()) - addAction(AllRule(), RCodeAction(dnsdist.REFUSED)) + addAction(AllRule(), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -156,7 +156,7 @@ class TestRecordsCountNothingInNS(DNSDistTest): _config_template = """ addAction(RecordsCountRule(DNSSection.Authority, 0, 0), AllowAction()) - addAction(AllRule(), RCodeAction(dnsdist.REFUSED)) + addAction(AllRule(), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ @@ -213,7 +213,7 @@ class TestRecordsCountNothingInNS(DNSDistTest): class TestRecordsCountNoOPTInAR(DNSDistTest): _config_template = """ - addAction(NotRule(RecordsTypeCountRule(DNSSection.Additional, dnsdist.OPT, 0, 0)), RCodeAction(dnsdist.REFUSED)) + addAction(NotRule(RecordsTypeCountRule(DNSSection.Additional, DNSQType.OPT, 0, 0)), RCodeAction(DNSRCode.REFUSED)) newServer{address="127.0.0.1:%s"} """ diff --git a/regression-tests.dnsdist/test_Responses.py b/regression-tests.dnsdist/test_Responses.py index ffbdf9426..fb9276493 100644 --- a/regression-tests.dnsdist/test_Responses.py +++ b/regression-tests.dnsdist/test_Responses.py @@ -8,7 +8,7 @@ class TestResponseRuleNXDelayed(DNSDistTest): _config_template = """ newServer{address="127.0.0.1:%s"} - addResponseAction(RCodeRule(dnsdist.NXDOMAIN), DelayResponseAction(1000)) + addResponseAction(RCodeRule(DNSRCode.NXDOMAIN), DelayResponseAction(1000)) """ def testNXDelayed(self): @@ -57,7 +57,7 @@ class TestResponseRuleERCode(DNSDistTest): _config_template = """ newServer{address="127.0.0.1:%s"} - addResponseAction(ERCodeRule(dnsdist.BADVERS), DelayResponseAction(1000)) + addResponseAction(ERCodeRule(DNSRCode.BADVERS), DelayResponseAction(1000)) """ def testBADVERSDelayed(self): @@ -244,7 +244,7 @@ class TestResponseLuaActionReturnSyntax(DNSDistTest): return DNSResponseAction.Drop end addResponseAction("drop.responses.tests.powerdns.com.", LuaResponseAction(customDrop)) - addResponseAction(RCodeRule(dnsdist.NXDOMAIN), LuaResponseAction(customDelay)) + addResponseAction(RCodeRule(DNSRCode.NXDOMAIN), LuaResponseAction(customDelay)) """ def testResponseActionDelayed(self): diff --git a/regression-tests.dnsdist/test_TCPKeepAlive.py b/regression-tests.dnsdist/test_TCPKeepAlive.py index 87aa54bf1..f975c9f40 100644 --- a/regression-tests.dnsdist/test_TCPKeepAlive.py +++ b/regression-tests.dnsdist/test_TCPKeepAlive.py @@ -29,7 +29,7 @@ class TestTCPKeepAlive(DNSDistTest): pc = newPacketCache(100, {maxTTL=86400, minTTL=1}) getPool(""):setCache(pc) addAction("largernumberofconnections.tcpka.tests.powerdns.com.", SkipCacheAction()) - addAction("refused.tcpka.tests.powerdns.com.", RCodeAction(dnsdist.REFUSED)) + addAction("refused.tcpka.tests.powerdns.com.", RCodeAction(DNSRCode.REFUSED)) addAction("dropped.tcpka.tests.powerdns.com.", DropAction()) addResponseAction("dropped-response.tcpka.tests.powerdns.com.", DropResponseAction()) -- create the pool named "nosuchpool" diff --git a/regression-tests.dnsdist/test_TeeAction.py b/regression-tests.dnsdist/test_TeeAction.py index 5adb3819b..156dcda7b 100644 --- a/regression-tests.dnsdist/test_TeeAction.py +++ b/regression-tests.dnsdist/test_TeeAction.py @@ -16,8 +16,8 @@ class TestTeeAction(DNSDistTest): setKey("%s") controlSocket("127.0.0.1:%s") newServer{address="127.0.0.1:%d"} - addAction(QTypeRule(dnsdist.A), TeeAction("127.0.0.1:%d", true)) - addAction(QTypeRule(dnsdist.AAAA), TeeAction("127.0.0.1:%d", false)) + addAction(QTypeRule(DNSQType.A), TeeAction("127.0.0.1:%d", true)) + addAction(QTypeRule(DNSQType.AAAA), TeeAction("127.0.0.1:%d", false)) """ _config_params = ['_consoleKeyB64', '_consolePort', '_testServerPort', '_teeServerPort', '_teeServerPort'] @classmethod -- 2.40.0