From: Pieter Lexis Date: Thu, 14 Jan 2016 12:59:09 +0000 (+0100) Subject: Add test for zone2sql --json-comments X-Git-Tag: dnsdist-1.0.0-alpha2~43^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9a521eee6f890fcfedea58bbdf7fa323b262d56;p=pdns Add test for zone2sql --json-comments Closes #3181 --- diff --git a/regression-tests.nobackend/zone2sql-json-comments/command b/regression-tests.nobackend/zone2sql-json-comments/command new file mode 100755 index 000000000..de2967b84 --- /dev/null +++ b/regression-tests.nobackend/zone2sql-json-comments/command @@ -0,0 +1,5 @@ +#!/bin/sh + +# We use faketime because the comments table has a modified_at field +${ZONE2SQL} --gsqlite --zone=zone2sql-json-comments/example.net.zone --json-comments | \ + perl -p -e 's/[0-9]{10,12}/1234567890/g' diff --git a/regression-tests.nobackend/zone2sql-json-comments/description b/regression-tests.nobackend/zone2sql-json-comments/description new file mode 100644 index 000000000..6062980c3 --- /dev/null +++ b/regression-tests.nobackend/zone2sql-json-comments/description @@ -0,0 +1 @@ +Parse a zone file to see if json comments are parsed correctly by zone2sql diff --git a/regression-tests.nobackend/zone2sql-json-comments/example.net.zone b/regression-tests.nobackend/zone2sql-json-comments/example.net.zone new file mode 100644 index 000000000..e34cf8324 --- /dev/null +++ b/regression-tests.nobackend/zone2sql-json-comments/example.net.zone @@ -0,0 +1,9 @@ +$ORIGIN example.net +$TTL 3600 + +@ IN SOA ns1.example.net. hostmaster.example.net. 1 1 1 1 1 ; This comment is ignored + +@ IN NS ns1.example.net ; json={"comment": "Some NS record"} +@ IN NS ns2.example.net ; json={"comment": "This one is disabled", "disabled": true} + +ns1 IN A 127.0.0.1 ; json={"disabled": true} diff --git a/regression-tests.nobackend/zone2sql-json-comments/expected_result b/regression-tests.nobackend/zone2sql-json-comments/expected_result new file mode 100644 index 000000000..5179515fe --- /dev/null +++ b/regression-tests.nobackend/zone2sql-json-comments/expected_result @@ -0,0 +1,7 @@ +insert into domains (name,type) values ('example.net','NATIVE'); +insert into records (domain_id, name, type,content,ttl,prio,disabled) select id ,'example.net', 'SOA', 'ns1.example.net hostmaster.example.net 1 1 1 1 1', 3600, 0, 0 from domains where name='example.net'; +insert into records (domain_id, name, type,content,ttl,prio,disabled) select id ,'example.net', 'NS', 'ns1.example.net.example.net', 3600, 0, 0 from domains where name='example.net'; +insert into comments (domain_id,name,type,modified_at, comment) select id, 'example.net', 'NS', 1234567890, 'Some NS record' from domains where name='example.net'; +insert into records (domain_id, name, type,content,ttl,prio,disabled) select id ,'example.net', 'NS', 'ns2.example.net.example.net', 3600, 0, 1 from domains where name='example.net'; +insert into comments (domain_id,name,type,modified_at, comment) select id, 'example.net', 'NS', 1234567890, 'This one is disabled' from domains where name='example.net'; +insert into records (domain_id, name, type,content,ttl,prio,disabled) select id ,'ns1.example.net', 'A', '127.0.0.1', 3600, 0, 1 from domains where name='example.net';