Ignore:
Timestamp:
01/26/26 15:23:50 (2 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Revise test for adding expiring CNAME when an existing expired CNAME already
exists to match updated logic tree and truth table.
See #72, #88

File:
1 edited

Legend:

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

    r997 r1001  
    313313      $newname = 'expires-at5.expiry2.test';
    314314      ($code, $msg) = $dnsdb->addRec('n', 'n', 5, \$newname, \$rectype, \$newval, 900, undef, 't', $expirystamp);
    315       ok( $code eq 'OK', "addRec() claimed success" );
    316       if ($code eq 'OK') {
     315      cmp_ok( $code, 'eq', 'FAIL', "addRec() claimed failure" );
     316      if ($code eq 'FAIL') {
    317317        # crosscheck in the DB
    318318        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 5 AND host = '$newname'");
    319         ok( $rcount == 2, " ... [$rcount] correct number of records for $newname" );
    320         my ($newstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 5 AND host = '$newname' ".
    321                 "AND stampactive = 't' AND expires = 't' AND stamp >= now()");
    322         my ($oldstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 5 AND host = '$newname' ".
    323                 "AND stampactive = 't' AND expires = 't' AND stamp <= now()");
    324         ok( $newstamp > $oldstamp, " ... added record expires after existing, already-expired record" );
    325       } else {
    326         print "not ok: $msg";
     319        ok( $rcount == 1, " ... [$rcount] correct number of records for $newname" );
     320        like( $msg, qr/non-CNAME records with timestamps already exist/, " ... returned matching error" );
    327321      }
    328322    };
Note: See TracChangeset for help on using the changeset viewer.