This should also fix #4534, when backported.
{
for(const DNSResourceRecord& rr: result_rr)
{
+ if (!rr.qtype.getCode())
+ continue; // skip empty non-terminals
+
auto object = Json::object {
{ "object_type", "record" },
{ "name", rr.qname.toString() },
SQLITE_DB = 'pdns.sqlite3'
WEBPORT = '5556'
APIKEY = '1234567890abcdefghijklmnopq-key'
+PDNSUTIL_CMD = ["../pdns/pdnsutil", "--config-dir=."]
NAMED_CONF_TPL = """
# Generated by runtests.py
with open('pdns.conf', 'w') as named_conf:
named_conf.write(AUTH_CONF_TPL)
- subprocess.check_call(["../pdns/pdnsutil", "--config-dir=.", "secure-zone", "powerdnssec.org"])
+ subprocess.check_call(PDNSUTIL_CMD + ["secure-zone", "powerdnssec.org"])
pdnscmd = ("../pdns/pdns_server --daemon=no --local-address=127.0.0.1 --local-port=5300 --socket-dir=./ --no-shuffle --dnsupdate=yes --cache-ttl=0 --config-dir=. --api=yes --webserver-port="+WEBPORT+" --webserver-address=127.0.0.1 --api-key="+APIKEY).split()
else:
rc = 0
test_env = {}
test_env.update(os.environ)
-test_env.update({'WEBPORT': WEBPORT, 'APIKEY': APIKEY, 'DAEMON': daemon, 'SQLITE_DB': SQLITE_DB})
+test_env.update({
+ 'WEBPORT': WEBPORT,
+ 'APIKEY': APIKEY,
+ 'DAEMON': daemon,
+ 'SQLITE_DB': SQLITE_DB,
+ 'PDNSUTIL_CMD': ' '.join(PDNSUTIL_CMD),
+})
try:
print ""
import unittest
from copy import deepcopy
from pprint import pprint
-from test_helper import ApiTestCase, unique_zone_name, is_auth, is_recursor, get_db_records
+from test_helper import ApiTestCase, unique_zone_name, is_auth, is_recursor, get_db_records, pdnsutil_rectify
def get_rrset(data, qname, qtype):
# should return zone, SOA, ns1, ns2
self.assertEquals(len(r.json()), 4)
+ def test_search_after_rectify_with_ent(self):
+ name = 'search-rectified.name.'
+ rrset = {
+ "name": 'sub.sub.' + name,
+ "type": "A",
+ "ttl": 3600,
+ "records": [{
+ "content": "4.3.2.1",
+ "disabled": False,
+ }],
+ }
+ self.create_zone(name=name, rrsets=[rrset])
+ pdnsutil_rectify(name)
+ r = self.session.get(self.url("/api/v1/servers/localhost/search-data?q=*search-rectified*"))
+ self.assert_success_json(r)
+ print r.json()
+ # should return zone, SOA, ns1, ns2, sub.sub A (but not the ENT)
+ self.assertEquals(len(r.json()), 5)
+
@unittest.skipIf(not is_auth(), "Not applicable")
class AuthRootZone(ApiTestCase, AuthZonesHelperMixin):
self.assertEquals(data[k], payload[k])
def test_create_zone_no_name(self):
- name = unique_zone_name()
payload = {
'name': '',
'kind': 'Native',
import urlparse
import unittest
import sqlite3
+import subprocess
DAEMON = os.environ.get('DAEMON', 'authoritative')
+PDNSUTIL_CMD = os.environ.get('PDNSUTIL_CMD', 'NOT_SET BUT_THIS MIGHT_BE_A_LIST').split(' ')
SQLITE_DB = os.environ.get('SQLITE_DB', 'pdns.sqlite3')
recs = [{'name': row[0], 'type': row[1], 'content': row[2], 'ttl': row[3]} for row in rows]
print "DB Records:", recs
return recs
+
+
+def pdnsutil_rectify(zonename):
+ """Run pdnsutil rectify-zone on the given zone."""
+ subprocess.check_call(PDNSUTIL_CMD + ['rectify-zone', zonename])