@@ -748,6 +748,7 @@ func TestWaitForService(t *testing.T) {
748
748
serving , client := setup ()
749
749
750
750
serviceName := "test-service"
751
+ readyServiceName := "ready-service"
751
752
notFoundServiceName := "not-found-service"
752
753
internalErrorServiceName := "internal-error-service"
753
754
@@ -771,6 +772,9 @@ func TestWaitForService(t *testing.T) {
771
772
case serviceName :
772
773
err = nil
773
774
svc = newService (serviceName )
775
+ case readyServiceName :
776
+ err = nil
777
+ svc = wait .CreateTestServiceWithConditions (readyServiceName , corev1 .ConditionTrue , corev1 .ConditionTrue , "" , "" , 2 )
774
778
case notFoundServiceName :
775
779
err = apierrors .NewNotFound (servingv1 .Resource ("service" ), notFoundServiceName )
776
780
case internalErrorServiceName :
@@ -790,6 +794,15 @@ func TestWaitForService(t *testing.T) {
790
794
assert .NilError (t , err )
791
795
assert .Assert (t , duration > 0 )
792
796
})
797
+ t .Run ("wait on a service that is already ready with success" , func (t * testing.T ) {
798
+ err , duration := client .WaitForService (context .Background (), readyServiceName , WaitConfig {
799
+ Timeout : time .Duration (10 ) * time .Second ,
800
+ ErrorWindow : time .Duration (2 ) * time .Second ,
801
+ }, wait .NoopMessageCallback ())
802
+ assert .NilError (t , err )
803
+ println ("duration:" , duration )
804
+ assert .Assert (t , duration == 0 )
805
+ })
793
806
t .Run ("wait on a service to become ready with not found error" , func (t * testing.T ) {
794
807
err , duration := client .WaitForService (context .Background (), notFoundServiceName , WaitConfig {
795
808
Timeout : time .Duration (10 ) * time .Second ,
0 commit comments