From 207e77dda14219df7bda026df4a492b86adbbb68 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 29 Jul 2020 13:47:30 +0300 Subject: [PATCH] dnsdist: Fix tests to use tostring --- regression-tests.dnsdist/test_Advanced.py | 4 ++-- regression-tests.dnsdist/test_DynBlocks.py | 2 +- regression-tests.dnsdist/test_EDNSOptions.py | 2 +- regression-tests.dnsdist/test_Protobuf.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/regression-tests.dnsdist/test_Advanced.py b/regression-tests.dnsdist/test_Advanced.py index c4eb7c3736..13fa8a372c 100644 --- a/regression-tests.dnsdist/test_Advanced.py +++ b/regression-tests.dnsdist/test_Advanced.py @@ -1474,7 +1474,7 @@ class TestAdvancedGetLocalAddressOnAnyBind(DNSDistTest): _config_template = """ function answerBasedOnLocalAddress(dq) - local dest = dq.localaddr:toString() + local dest = tostring(dq.localaddr) local i, j = string.find(dest, "[0-9.]+") local addr = string.sub(dest, i, j) local dashAddr = string.gsub(addr, "[.]", "-") @@ -1942,7 +1942,7 @@ class TestAdvancedLuaRule(DNSDistTest): return false end - if dq.qname:toString() ~= 'lua-rule.advanced.tests.powerdns.com.' then + if tostring(dq.qname) ~= 'lua-rule.advanced.tests.powerdns.com.' then print('invalid qname') return false end diff --git a/regression-tests.dnsdist/test_DynBlocks.py b/regression-tests.dnsdist/test_DynBlocks.py index 44ad7598d7..3e75af4d7e 100644 --- a/regression-tests.dnsdist/test_DynBlocks.py +++ b/regression-tests.dnsdist/test_DynBlocks.py @@ -833,7 +833,7 @@ class TestDynBlockAllowlist(DynBlocksTest): function maintenance() toBlock = exceedQRate(%d, %d) for addr, count in pairs(toBlock) do - if addr:toString() == "127.0.0.1" then + if tostring(addr) == "127.0.0.1" then allowlisted = true toBlock[addr] = nil end diff --git a/regression-tests.dnsdist/test_EDNSOptions.py b/regression-tests.dnsdist/test_EDNSOptions.py index f1e386e825..2bf76b9706 100644 --- a/regression-tests.dnsdist/test_EDNSOptions.py +++ b/regression-tests.dnsdist/test_EDNSOptions.py @@ -8,7 +8,7 @@ class EDNSOptionsBase(DNSDistTest): _ednsTestFunction = """ function testEDNSOptions(dq) local options = dq:getEDNSOptions() - local qname = dq.qname:toString() + local qname = tostring(dq.qname) if string.match(qname, 'noedns') then if next(options) ~= nil then diff --git a/regression-tests.dnsdist/test_Protobuf.py b/regression-tests.dnsdist/test_Protobuf.py index a864e39b3a..beaab89aba 100644 --- a/regression-tests.dnsdist/test_Protobuf.py +++ b/regression-tests.dnsdist/test_Protobuf.py @@ -144,7 +144,7 @@ class TestProtobuf(DNSDistProtobufTest): function alterProtobufResponse(dq, protobuf) if luasmn:check(dq.qname) then - requestor = newCA(dq.remoteaddr:toString()) -- called by testLuaProtobuf() + requestor = newCA(tostring(dq.remoteaddr)) -- called by testLuaProtobuf() if requestor:isIPv4() then requestor:truncate(24) else @@ -179,7 +179,7 @@ class TestProtobuf(DNSDistProtobufTest): function alterProtobufQuery(dq, protobuf) if luasmn:check(dq.qname) then - requestor = newCA(dq.remoteaddr:toString()) -- called by testLuaProtobuf() + requestor = newCA(tostring(dq.remoteaddr)) -- called by testLuaProtobuf() if requestor:isIPv4() then requestor:truncate(24) else @@ -200,7 +200,7 @@ class TestProtobuf(DNSDistProtobufTest): protobuf:setResponseCode(DNSRCode.NXDOMAIN) -- set protobuf response code to be NXDOMAIN - local strReqName = dq.qname:toString() -- get request dns name + local strReqName = tostring(dq.qname) -- get request dns name protobuf:setProtobufResponseType() -- set protobuf to look like a response and not a query, with 0 default time -- 2.47.2