Ignore:
Timestamp:
02/03/26 11:56:15 (5 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Add the other three tests for "update record to non-timestamp CNAME
colliding with variously timestamped existing record"
See #72, #88

File:
1 edited

Legend:

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

    r1015 r1016  
    401401      }
    402402    };
     403    subtest 'collision with soon to expire record' => sub {
     404      $newname = 'nostamp2a.expiry3.test';
     405      ($code, $msg) = $dnsdb->updateRec('n', 'n', 80, 6, \$newname, \$rectype, \$newval, 900);
     406      ok( $code eq 'FAIL', "updateRec() claimed failure" );
     407      if ($code eq 'FAIL') {
     408        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     409        ok( $rcount == 1, " ... [$rcount] yep, hostname only occurs once" );
     410        like( $msg, qr/non-CNAME records with timestamps already exist/, " ... returned matching error" );
     411      }
     412    };
     413    subtest 'collision with pending active-after record' => sub {
     414      $newname = 'nostamp3a.expiry3.test';
     415      ($code, $msg) = $dnsdb->updateRec('n', 'n', 81, 6, \$newname, \$rectype, \$newval, 900);
     416      ok( $code eq 'FAIL', "updateRec() claimed failure" );
     417      if ($code eq 'FAIL') {
     418        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     419        ok( $rcount == 1, " ... [$rcount] yep, hostname only occurs once" );
     420        like( $msg, qr/non-CNAME records with timestamps already exist/, " ... returned matching error" );
     421      }
     422    };
     423    subtest 'collision with active active-after record' => sub {
     424      $newname = 'nostamp4a.expiry3.test';
     425      ($code, $msg) = $dnsdb->updateRec('n', 'n', 82, 6, \$newname, \$rectype, \$newval, 900);
     426      ok( $code eq 'FAIL', "updateRec() claimed failure" );
     427      if ($code eq 'FAIL') {
     428        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     429        ok( $rcount == 1, " ... [$rcount] yep, hostname only occurs once" );
     430        like( $msg, qr/non-CNAME records with timestamps already exist/, " ... returned matching error" );
     431      }
     432    };
    403433  }; # update to CNAME with no timestamp
    404434
Note: See TracChangeset for help on using the changeset viewer.