Changeset 1028


Ignore:
Timestamp:
02/06/26 10:43:23 (4 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Test with updating to a valid-after CNAME:
Add test for collision with existing pending-expiry record with timestamp
before existing expiry
See #72, #88

File:
1 edited

Legend:

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

    r1027 r1028  
    527527      }
    528528    };
     529    subtest 'collision with expiring record, overlapping timestamps' => sub {
     530      $newname = 'validafter2a.expiry3.test';
     531      ($code, $msg) = $dnsdb->updateRec('n', 'n', 101, 6, \$newname, \$rectype, \$newval, 900, undef, 'f', $expirystamp);
     532      cmp_ok( $code, 'eq', 'WARN', "updateRec() claimed success with warning" );
     533      if ($code eq 'WARN') {
     534        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     535        ok( $rcount == 2, " ... [$rcount] correct number of records for $newname" );
     536        like( $msg, qr/updated with modified valid-after time;  conflicting expiring record found/, " ... returned appropriate warning message" );
     537        my ($newstamp) = $dbh->selectrow_array("SELECT stamp FROM records WHERE domain_id = 6 AND host = '$newname' ".
     538                "AND stampactive = 't' AND expires = 't'");
     539        my ($oldstamp) = $dbh->selectrow_array("SELECT stamp FROM records WHERE domain_id = 6 AND host = '$newname' ".
     540                "AND stampactive = 't' AND expires = 'f'");
     541        ok( $newstamp eq $oldstamp, " ... coerced timestamp matches existing expiry timestamp" );
     542      } else {
     543        print "not ok: $msg";
     544      }
     545    };
    529546  }; # update to valid-after CNAME
    530547
Note: See TracChangeset for help on using the changeset viewer.