11import os
22import time
3+ import datetime
4+
35import pytest
46import logging
57
@@ -362,21 +364,13 @@ def test_expiration_overflow_policy_reject(self):
362364 def test_expiration_overflow_policy_reject_default_ttl (self ):
363365 self ._base_expiration_overflow_policy_test (default_ttl = True , policy = 'REJECT' )
364366
365- @since ('4.2' )
366- def test_expiration_overflow_policy_none (self ):
367- self ._base_expiration_overflow_policy_test (default_ttl = False , policy = 'NONE' )
368-
369- @since ('4.2' )
370- def test_expiration_overflow_policy_none_default_ttl (self ):
371- self ._base_expiration_overflow_policy_test (default_ttl = True , policy = 'NONE' )
372-
373367 def _base_expiration_overflow_policy_test (self , default_ttl , policy ):
374368 """
375369 Checks that expiration date overflow policy is correctly applied
376370 @jira_ticket CASSANDRA-14092 and CASSANDRA-14227
377-
378- Notice this is using the legacy 20y limitation. Newer versions support up to 68y
379371 """
372+ # Post 4.2 C14227 won't overflow until year 2086
373+ overflow_policy_applies = self .cluster .version () < '4.2' or datetime .date .today ().year >= 2086
380374 MAX_TTL = 20 * 365 * 24 * 60 * 60 # 20 years in seconds
381375 default_time_to_live = MAX_TTL if default_ttl else None
382376 self .prepare (default_time_to_live = default_time_to_live )
@@ -394,9 +388,9 @@ def _base_expiration_overflow_policy_test(self, default_ttl, policy):
394388 try :
395389 result = self .session1 .execute_async (query + ";" )
396390 result .result ()
397- if policy == 'REJECT' :
391+ if policy == 'REJECT' and overflow_policy_applies :
398392 pytest .fail ("should throw InvalidRequest" )
399- if self .cluster .version () >= '3.0' : # client warn only on 3.0+
393+ if self .cluster .version () >= '3.0' and overflow_policy_applies : # client warn only on 3.0+
400394 if policy == 'CAP' :
401395 logger .debug ("Warning is {}" .format (result .warnings [0 ]))
402396 assert 'exceeds maximum supported expiration' in result .warnings [0 ], 'Warning not found'
@@ -409,10 +403,10 @@ def _base_expiration_overflow_policy_test(self, default_ttl, policy):
409403
410404 self .cluster .flush ()
411405 # Data should be present unless policy is reject
412- assert_row_count (self .session1 , 'ttl_table' , 0 if policy == 'REJECT' else 1 )
406+ assert_row_count (self .session1 , 'ttl_table' , 0 if ( policy == 'REJECT' and overflow_policy_applies ) else 1 )
413407
414408 # Check that warning is always logged, unless policy is REJECT
415- if policy != 'REJECT' and policy != 'NONE' :
409+ if policy != 'REJECT' and overflow_policy_applies :
416410 node1 = self .cluster .nodelist ()[0 ]
417411 prefix = 'default ' if default_ttl else ''
418412 warning = node1 .grep_log ("Request on table {}.{} with {}ttl of {} seconds exceeds maximum supported expiration"
0 commit comments