Changeset 1029


Ignore:
Timestamp:
02/06/26 10:46:43 (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
after existing expiry
See #72, #88

File:
1 edited

Legend:

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

    r1028 r1029  
    544544      }
    545545    };
     546    subtest 'collision with expiring record, non-overlapping timestamps' => sub {
     547      $newname = 'validafter3a.expiry3.test';
     548      ($code, $msg) = $dnsdb->updateRec('n', 'n', 102, 6, \$newname, \$rectype, \$newval, 900, undef, 'f', $expirystamp);
     549      cmp_ok( $code, 'eq', 'OK', "updateRec() claimed success" );
     550      if ($code eq 'OK') {
     551        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 6 AND host = '$newname'");
     552        ok( $rcount == 2, " ... [$rcount] correct number of records for $newname" );
     553        my ($newstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 6 AND host = '$newname' ".
     554                "AND stampactive = 't' AND expires = 't'");
     555        my ($oldstamp) = $dbh->selectrow_array("SELECT extract(epoch from stamp) FROM records WHERE domain_id = 6 AND host = '$newname' ".
     556                "AND stampactive = 't' AND expires = 'f'");
     557        ok( $newstamp <= $oldstamp, " ... added record becomes active after existing record expires" );
     558      } else {
     559        print "not ok: $msg";
     560      }
     561    };
    546562  }; # update to valid-after CNAME
    547563
Note: See TracChangeset for help on using the changeset viewer.