digd.js/TESTS.md

89 lines
2.9 KiB
Markdown
Raw Normal View History

2017-10-09 21:59:36 +00:00
Tests todo:
A - SERVFAIL - should return empty response, ra 0
A - NXDOMAIN - should return SOA
A - NOERROR - should return A record
- or delegated NS record
Record delegated to self should return SOA record rather than NS delegation
Casing should match on question section, always.
Casing should match on other sections if a direct match? (not required, but efficient for compression pointers)
- www.EXample.COm + example.com = EXample.COm
- EXample.COm + www.example.com = www.EXample.COm
- (this should be taken care of by compression pointer logic, once implemented)
2017-10-09 22:03:37 +00:00
Send malformed packets (both as queries and as answers):
- bad question count, answer count, etc
- bad rdata (too long, too short)
- proper packets, truncated
- randomly twiddled bits
- forward compression pointers
- compression pointers to wrong bits (throw error on non-ascii / unsafe chars)
Test that ANY queries return records of all types matching the domain
2017-10-12 18:48:09 +00:00
Test that A queries only return A records, not others matching the domain
2017-10-10 01:29:31 +00:00
2017-10-12 18:48:09 +00:00
Test that A queries for ANAME-enabled records (but no address) recurse (regardless of general recursion settings).
* 0-anames.example.com
* 1-aname.example.com
* 2-anames.example.com
Generally speaking test the cases of 0, 1, and 2 records of any given type (null case, single case, multi case)
2017-10-19 00:24:41 +00:00
```
# Serve:
node bin/digd.js +norecurse -p 65053 --input sample/db.json
```
2017-10-10 01:29:31 +00:00
```
# Sample Data:
2017-10-19 00:24:41 +00:00
# no A records for out-delegated.example.com
# two external NS records for delegted.example.com
# zone example.com exists
2017-10-10 01:29:31 +00:00
# Test:
# should return NS records in AUTHORITY section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 A out-delegated.example.com
node bin/dig.js @localhost -p 65053 ANY out-delegated.example.com
# should return SOA records in AUTHORITY section, nothing else
node bin/dig.js @localhost -p 65053 A in-delegated.example.com
node bin/dig.js @localhost -p 65053 ANY in-delegated.example.com
2017-10-10 01:29:31 +00:00
# should return NS records in ANSWER section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 NS out-delegated.example.com
node bin/dig.js @localhost -p 65053 NS in-delegated.example.com
2017-10-10 01:29:31 +00:00
# Sample Data:
2017-10-19 00:24:41 +00:00
# two A records for example.com
2017-10-10 01:29:31 +00:00
# no NS records
# Test:
# should return A records in ANSWER section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 A example.com
2017-10-10 01:29:31 +00:00
# should return SOA records in AUTHORITY section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 A doesntexist.example.com
node bin/dig.js @localhost -p 65053 NS doesntexist.example.com
2017-10-10 01:29:31 +00:00
# Sample Data:
2017-10-19 00:24:41 +00:00
# two A records for a.example.com
2017-10-10 01:29:31 +00:00
# has **internal** NS records
# Test:
# should return A record in ANSWER section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 A a.example.com
2017-10-10 01:29:31 +00:00
# should return SOA record in AUTHORITY section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 A doesntexist.a.example.com
2017-10-10 01:29:31 +00:00
# should return NS records in ANSWER section, nothing else
2017-10-19 00:24:41 +00:00
node bin/dig.js @localhost -p 65053 NS a.example.com
2017-10-10 01:29:31 +00:00
```