Changeset 986 for branches/cname-collision/t/DNSTest.pm
- Timestamp:
- 01/15/26 16:10:29 (9 hours ago)
- Location:
- branches/cname-collision
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
t/DNSTest.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/cname-collision
-
branches/cname-collision/t/DNSTest.pm
r977 r986 56 56 ## Prepare the DB 57 57 # Check that we aren't in an obviously production DB before blowing it away. 58 # A DB instantiated for these tests should NEVER have more than a handful of domains and maybe 20-30records.58 # A DB instantiated for these tests should have a known set of domains and records. 59 59 60 60 $dbh = $dnsdb->{dbh}; 61 61 62 my ($dcount) = $dbh->selectrow_array("SELECT count(*) FROM domains"); 63 BAIL_OUT("# DB looks like it may not be a test DB, found $dcount > 10 domains!\n") 64 if $dcount > 10; 65 cmp_ok( $dcount, '<=', 10, "domain count ($dcount): looks like a test DB" ); 62 my ($dcount) = $dbh->selectrow_array("SELECT count(*) FROM domains WHERE NOT domain IN ". 63 "('example.com','example.net','example.org','expiry1.test','expiry2.test')"); 64 BAIL_OUT("# DB looks like it may not be a test DB, found $dcount > 0 non-test domains!\n") 65 if $dcount > 0; 66 cmp_ok( $dcount, '==', 0, "non-test domain count ($dcount): looks like a test DB" ); 66 67 67 my ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records"); 68 my $maxrecs = 60; 68 my ($rcount) = $dbh->selectrow_array(qq{SELECT count(*) FROM records WHERE NOT ( 69 host like '%example.com' or host like '%example.net' or host like '%example.org' or 70 host like '%expiry1.test' or host like '%expiry2.test' or inetlazy(val) << '192.168.2.0/27' 71 )}); 72 my $maxrecs = 0; 69 73 BAIL_OUT("# DB looks like it may not be a test DB, found $rcount > $maxrecs records!\n") 70 74 if $rcount > $maxrecs; 71 cmp_ok( $rcount, '<=', $maxrecs, " record ($rcount): looks like a test DB" );75 cmp_ok( $rcount, '<=', $maxrecs, "non-test record ($rcount): looks like a test DB" ); 72 76 73 77 # drop all tables etc
Note:
See TracChangeset
for help on using the changeset viewer.
![[ DNS Administrator ]](/fx/dnsadmin-logo.png)