Ignore:
Timestamp:
01/15/26 16:10:29 (9 hours ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Interim merge from /trunk

Location:
branches/cname-collision
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cname-collision

    • Property svn:mergeinfo changed
      /trunkmerged: 985
  • branches/cname-collision/t/DNSTest.pm

    r977 r986  
    5656  ## Prepare the DB
    5757  # 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-30 records.
     58  # A DB instantiated for these tests should have a known set of domains and records.
    5959
    6060  $dbh = $dnsdb->{dbh};
    6161
    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" );
    6667
    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;
    6973  BAIL_OUT("# DB looks like it may not be a test DB, found $rcount > $maxrecs records!\n")
    7074        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" );
    7276
    7377  # drop all tables etc
Note: See TracChangeset for help on using the changeset viewer.