@@ -677,6 +677,66 @@ func TestVerification_RequeueImmediate_WhenWakeInPast(t *testing.T) {
677677 assert .Equal (t , 1 * time .Second , res .RequeueAfter )
678678}
679679
680+ func TestVerification_RequeueFloorsSubSecondToOneSecond (t * testing.T ) {
681+ s := runtime .NewScheme ()
682+ _ = scheme .AddToScheme (s )
683+ _ = networkingv1alpha .AddToScheme (s )
684+
685+ // Fixed reference time
686+ now := time .Date (2025 , 10 , 22 , 15 , 40 , 14 , 0 , time .UTC )
687+
688+ // Domain has verification with next attempt 500ms in the future
689+ dom := newDomain ("default" , "due-subsecond" , func (d * networkingv1alpha.Domain ) {
690+ d .Status .Verification = & networkingv1alpha.DomainVerificationStatus {
691+ DNSRecord : networkingv1alpha.DNSVerificationRecord {
692+ Name : "_dnsverify.example.com" ,
693+ Type : "TXT" ,
694+ Content : "token" ,
695+ },
696+ NextVerificationAttempt : metav1.Time {Time : now .Add (500 * time .Millisecond )},
697+ }
698+ })
699+
700+ cl := fake .NewClientBuilder ().WithScheme (s ).WithObjects (dom ).WithStatusSubresource (dom ).Build ()
701+ mgr := & fakeMockManager {cl : cl }
702+
703+ operatorConfig := config.NetworkServicesOperator {
704+ DomainVerification : config.DomainVerificationConfig {
705+ RetryIntervals : []config.RetryInterval {{Interval : metav1.Duration {Duration : time .Second }}},
706+ RetryJitterMaxFactor : 0 ,
707+ },
708+ DomainRegistration : config.DomainRegistrationConfig {
709+ LookupTimeout : & metav1.Duration {Duration : 3 * time .Second },
710+ RefreshInterval : & metav1.Duration {Duration : time .Hour },
711+ JitterMaxFactor : 0.1 ,
712+ RetryBackoff : & metav1.Duration {Duration : time .Minute },
713+ },
714+ }
715+
716+ r := & DomainReconciler {
717+ mgr : mgr ,
718+ Config : operatorConfig ,
719+ timeNow : func () time.Time { return now },
720+ // Stubs to avoid real I/O
721+ httpGet : func (ctx context.Context , url string ) ([]byte , * http.Response , error ) {
722+ return nil , nil , fmt .Errorf ("not implemented" )
723+ },
724+ lookupTXT : func (ctx context.Context , name string ) ([]string , error ) { return nil , & net.DNSError {IsNotFound : true } },
725+ rdapDo : func (ctx context.Context , req * rdap.Request ) (* rdap.Response , error ) {
726+ return & rdap.Response {Object : & rdap.Domain {LDHName : "example.com" }}, nil
727+ },
728+ lookupNS : func (ctx context.Context , name string ) ([]* net.NS , error ) { return nil , & net.DNSError {IsNotFound : true } },
729+ lookupIP : func (ctx context.Context , name string ) ([]net.IPAddr , error ) { return nil , nil },
730+ rdapQueryIP : func (ctx context.Context , ip string ) (* rdap.IPNetwork , error ) { return nil , nil },
731+ }
732+
733+ res , err := r .Reconcile (context .Background (), mcreconcile.Request {ClusterName : "test" , Request : reconcile.Request {NamespacedName : client .ObjectKeyFromObject (dom )}})
734+ assert .NoError (t , err )
735+
736+ // We should schedule a 1s requeue minimum for sub-second remaining
737+ assert .Equal (t , 1 * time .Second , res .RequeueAfter )
738+ }
739+
680740func TestRegistration_Subdomain_DelegationOverridesApexNS (t * testing.T ) {
681741 s := runtime .NewScheme ()
682742 _ = scheme .AddToScheme (s )
0 commit comments