Ignore:
Timestamp:
01/16/26 13:22:15 (3 weeks ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Add test and target record for checking adding an expiring CNAME after a
same-name record has expired.
See #72, #88

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cname-collision/t/cname.t

    r993 r994  
    318318      }
    319319    };
     320    subtest 'collision with expired record' => sub {
     321      $newname = 'expires-at5.expiry2.test';
     322      ($code, $msg) = $dnsdb->addRec('n', 'n', 5, \$newname, \$rectype, \$newval, 900, undef, 't', $expirystamp);
     323      ok( $code eq 'OK', "addRec() claimed success" );
     324      if ($code eq 'OK') {
     325        # crosscheck in the DB
     326        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 5 AND host = '$newname'");
     327        ok( $rcount == 2, " ... [$rcount] correct number of records for $newname" );
     328        my ($newstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 5 AND host = '$newname' ".
     329                "AND stampactive = 't' AND expires = 't' AND stamp >= now()");
     330        my ($oldstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 5 AND host = '$newname' ".
     331                "AND stampactive = 't' AND expires = 't' AND stamp <= now()");
     332        ok( $newstamp > $oldstamp, " ... added record expires after existing, already-expired record" );
     333      } else {
     334        print "not ok: $msg";
     335      }
     336    };
    320337  }; # add expiring CNAME
    321338
Note: See TracChangeset for help on using the changeset viewer.