Changeset 1020


Ignore:
Timestamp:
02/05/26 12:53:54 (5 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Add test group for updating a record to a CNAME with an expiry
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

    r1016 r1020  
    433433  }; # update to CNAME with no timestamp
    434434
     435  subtest 'CNAME update - expires soon' => sub {
     436    my @ltime = localtime(time + 86400 * 3);
     437    $expirystamp = sprintf "%i-%i-%i %i:%i", $ltime[5] + 1900, ($ltime[4] + 1) % 12, $ltime[3], 15, $ltime[1];
     438    $newval = 'target.example.com';
     439    subtest 'collision with nonexpiring record' => sub {
     440      $newname = 'expires1a.expiry3.test';
     441      ($code, $msg) = $dnsdb->updateRec('n', 'n', 89, 6, \$newname, \$rectype, \$newval, 900, undef, 't', $expirystamp);
     442      ok($code eq 'FAIL', "updateRec() claimed failure");
     443      if ($code eq 'FAIL') {
     444        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     445        ok( $rcount == 1, " ... [$rcount] yep, hostname only occurs once" );
     446        like( $msg, qr/One or more non-CNAME records/, " ... returned matching error" );
     447      }
     448    };
     449  };
     450
    435451}; # record expiry/valid-after
    436452
Note: See TracChangeset for help on using the changeset viewer.