| 
									
										
										
										
											2017-10-09 15:59:36 -06: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 16:03:37 -06: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) | 
					
						
							| 
									
										
										
										
											2017-10-09 19:17:34 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Test that ANY queries return records of all types matching the domain | 
					
						
							| 
									
										
										
										
											2017-10-12 12:48:09 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-09 19:17:34 -06:00
										 |  |  | Test that A queries only return A records, not others matching the domain | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 12:48:09 -06: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-20 11:37:04 -06:00
										 |  |  | ### Variables
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | port=65053 | 
					
						
							|  |  |  | ns=localhost | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | # For the sake of accuracy, it's most important to test with the standard unix dig tool
 | 
					
						
							|  |  |  | digcmd="dig" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # For the sake of completeness, it's important to test with our very own dig tool
 | 
					
						
							|  |  |  | #digcmd="node bin/dig.js"
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | ### Run the server
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | # Serve:
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | node bin/digd.js +norecurse -p $port --input sample/db.json | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | ### Manual Tests
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | # Sample Data:
 | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | #   no A records for out-delegated.example.com
 | 
					
						
							|  |  |  | #   two external NS records for delegted.example.com
 | 
					
						
							|  |  |  | #   zone example.com exists
 | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Test:
 | 
					
						
							|  |  |  | #   should return NS records in AUTHORITY section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | $digcmd @$ns -p $port A out-delegated.example.com | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port ANY out-delegated.example.com | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | #   should return SOA records in AUTHORITY section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port A in-delegated.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY in-delegated.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | #   should return NS records in ANSWER section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port NS out-delegated.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port NS in-delegated.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Sample Data:
 | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | #   two A records for example.com
 | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | #   no NS records
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Test:
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | #   should return records in ANSWER section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port A example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port AAAA example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port MX example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port SRV example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port TXT example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | #   should return SOA records in AUTHORITY section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port A doesntexist.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port NS doesntexist.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Sample Data:
 | 
					
						
							| 
									
										
										
										
											2017-10-18 18:24:41 -06:00
										 |  |  | #   two A records for a.example.com
 | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | #   has **internal** NS records
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Test:
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:55:22 -06:00
										 |  |  | #   should return record of correct type in ANSWER section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port A a.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port AAAA aaaa.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port MX mx.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port SRV srv.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port TXT txt.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port TXT mtxt.example.com | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #   should return record of correct type in ANSWER section, and SOA / NS
 | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY a.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY aaaa.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY mx.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY srv.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY txt.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p $port ANY mtxt.example.com | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Test:
 | 
					
						
							|  |  |  | #   all subdomains of a delegated domain should return NS for that domain
 | 
					
						
							|  |  |  | $digcmd @$ns -p 65053 ANY ns.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p 65053 ANY foo.ns.example.com | 
					
						
							|  |  |  | $digcmd @$ns -p 65053 ANY bar.foo.ns.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | #   should return SOA record in AUTHORITY section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port A doesntexist.a.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | #   should return NS records in ANSWER section, nothing else
 | 
					
						
							| 
									
										
										
										
											2017-10-20 11:37:04 -06:00
										 |  |  | $digcmd @$ns -p $port NS a.example.com | 
					
						
							| 
									
										
										
										
											2017-10-09 19:29:31 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | ``` |