Ignore:
Timestamp:
01/16/26 11:20:11 (8 days ago)
Author:
Kris Deugau
Message:

/branches/cname-collision

Add test and supporting record for new CNAME with expiry after an existing
record's valid-after timestamp
See #72, #88

Location:
branches/cname-collision/t
Files:
3 edited

Legend:

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

    r991 r992  
    296296      }
    297297    };
     298    subtest 'expire after valid-after record' => sub {
     299      $newname = 'expires-at4.expiry2.test';
     300      ($code, $msg) = $dnsdb->addRec('n', 'n', 5, \$newname, \$rectype, \$newval, 900, undef, 't', $expirystamp);
     301      ok( $code eq 'WARN', "addRec() claimed success with warning" );
     302      if ($code eq 'WARN') {
     303        ($rcount) = $dbh->selectrow_array("SELECT count(*) FROM records WHERE domain_id = 5 AND host = '$newname'");
     304        ok( $rcount == 2, " ... [$rcount] correct number of records for $newname" );
     305        like( $msg, qr/added with modified expiry time;  conflicting valid-after record found/, " ... returned appropriate warning message" );
     306        my ($newstamp) = $dbh->selectrow_array("SELECT stamp FROM records WHERE domain_id = 5 AND host = '$newname' ".
     307                "AND stampactive = 't' AND expires = 't'");
     308        my ($oldstamp) = $dbh->selectrow_array("SELECT stamp FROM records WHERE domain_id = 5 AND host = '$newname' ".
     309                "AND stampactive = 't' AND expires = 'f'");
     310        ok( $newstamp eq $oldstamp, " ... coerced timestamp matches existing active-after timestamp" );
     311      } else {
     312        print "not ok: $msg";
     313      }
     314    };
    298315  }; # add expiring CNAME
    299316
  • branches/cname-collision/t/dns-unitbase.sql

    r988 r992  
    6586583       example.net     1               1       2025121800      D       f       ab
    6596594       expiry1.test    1               1       2026011400      D       t       
    660 5       expiry2.test    1               1       2026011502      D       t       
     6605       expiry2.test    1               1       2026011503      D       t       
    661661\.
    662662
     
    77777769      5       1       1       admin   Initial User    Added record 'expires-at2.expiry2.test TXT imma expire soon', TTL 5400, expires at 2026-01-15 18:00     2026-01-15 12:58:51.09629-05    0       0
    77877870      5       1       1       admin   Initial User    Added record 'expires-at3.expiry2.test TXT active after pending expiry', TTL 5400, expires at 2026-01-15 18:00  2026-01-15 13:21:31.833257-05   0       0
     77971      5       1       1       admin   Initial User    Added record 'expires-at4.expiry2.test TXT active before pending expiry', TTL 5400, expires at 2026-01-15 18:00 2026-01-15 17:59:01.61806-05    0       0
    779780\.
    780781
     
    784785--
    785786
    786 SELECT pg_catalog.setval('public.log_log_id_seq', 70, true);
     787SELECT pg_catalog.setval('public.log_log_id_seq', 71, true);
    787788
    788789
     
    8858865       59      expires-at2.expiry2.test        16      imma expire soon        0       0       0       5400    \N      0               2026-01-15 18:00:00-05  t       t       \N
    8868875       60      expires-at3.expiry2.test        16      active after pending expiry     0       0       0       5400    \N      0               2026-01-15 18:00:00-05  f       t       \N
     8885       61      expires-at4.expiry2.test        16      active before pending expiry    0       0       0       5400    \N      0               2026-01-15 18:00:00-05  f       t       \N
    887889\.
    888890
     
    892894--
    893895
    894 SELECT pg_catalog.setval('public.records_record_id_seq', 60, true);
     896SELECT pg_catalog.setval('public.records_record_id_seq', 61, true);
    895897
    896898
  • branches/cname-collision/t/test-cname-timestamps.sql

    r988 r992  
    1010UPDATE records SET stamp = date_trunc('day', now() + interval '4 day') + '11:30' WHERE record_id = 59;
    1111UPDATE records SET stamp = date_trunc('day', now() + interval '4 day') + '11:30' WHERE record_id = 60;
     12UPDATE records SET stamp = date_trunc('day', now() + interval '2 day') + '11:30' WHERE record_id = 61;
Note: See TracChangeset for help on using the changeset viewer.