@@ -25,9 +25,14 @@ ${FUTURE_DAYS} 150
2525*** Test Cases ***
2626Certificate Rotation
2727 [Documentation] Performs Certificate Expiration Rotation test
28+ # Certificates expire at midnight of (tomorrow + validity). For short-lived certs,
29+ # validity is 365 days, so expiry = tomorrow + 365 days.
2830 ${first_cert_date } = Compute Date After Days 365 ${OSSL_DATE_FORMAT }
2931 Certs Should Expire On ${KUBE_SCHEDULER_CLIENT_CERT } ${first_cert_date }
30- ${cert_should_expire_in_days } = Evaluate 365+${FUTURE_DAYS }
32+ # After moving the clock forward by FUTURE_DAYS, regenerated certs will expire at
33+ # (new tomorrow + 365). Since "new tomorrow" is (original tomorrow + FUTURE_DAYS + 1),
34+ # the expected expiry from the original date is: tomorrow + 366 + FUTURE_DAYS.
35+ ${cert_should_expire_in_days } = Evaluate 366+${FUTURE_DAYS }
3136 ${cert_expiry_date } = Compute Date After Days ${cert_should_expire_in_days } ${OSSL_DATE_FORMAT }
3237 ${future_date } = Compute Date After Days ${FUTURE_DAYS } ${TIMEDATECTL_DATE_FORMAT }
3338 Change System Date To ${future_date }
@@ -67,10 +72,10 @@ Change System Date To
6772 Wait For MicroShift
6873
6974Compute Date After Days
70- [Documentation] return system date after number of days elapsed
75+ [Documentation] return system date after number of days elapsed from midnight tomorrow
7176 [Arguments] ${number_of_days } ${date_format }
72- # date command is used here because we need to consider the remote vm timezone .
73- ${future_date } = Command Should Work TZ=UTC date "+${date_format } " -d "$(date) + ${number_of_days } day"
77+ # Certificates are aligned to expire at midnight of the next day + validity
78+ ${future_date } = Command Should Work TZ=UTC date "+${date_format } " -d "tomorrow + ${number_of_days } day"
7479 RETURN ${future_date }
7580
7681Certs Should Expire On
0 commit comments