Ignore:
Timestamp:
02/06/26 10:21:06 (2 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Add test group for updating a record to a valid-after CNAME
Add arguably redundant test checking for collision with nontimestamped record
See #72, #88

File:
1 edited

Legend:

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

    r1025 r1027  
    512512  }; # update to expiring CNAME
    513513
     514  ## Update to valid-after CNAME
     515  subtest 'CNAME update - valid after' => sub {
     516    my @ltime = localtime(time + 86400 * 3);
     517    $expirystamp = sprintf "%i-%i-%i %i:%i", $ltime[5] + 1900, ($ltime[4] + 1) % 12, $ltime[3], 15, $ltime[1];
     518    $newval = 'target.example.com';
     519    subtest 'collision with nonexpiring record' => sub {
     520      $newname = 'validafter1a.expiry3.test';
     521      ($code, $msg) = $dnsdb->updateRec('n', 'n', 100, 6, \$newname, \$rectype, \$newval, 900, undef, 'f', $expirystamp);
     522      ok( $code eq 'FAIL', "updateRec() claimed failure" );
     523      if ($code eq 'FAIL') {
     524        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     525        ok( $rcount == 1, " ... [$rcount] yep, hostname only occurs once" );
     526        like( $msg, qr/One or more non-CNAME records/, " ... returned matching error" );
     527      }
     528    };
     529  }; # update to valid-after CNAME
     530
    514531}; # record expiry/valid-after
    515532
Note: See TracChangeset for help on using the changeset viewer.