@ -79,7 +79,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -79,7 +79,7 @@ class HealthCheckServiceInstanceListSupplierTests {
}
@AfterEach
void tearDown ( ) throws Exception {
void tearDown ( ) {
if ( listSupplier ! = null ) {
listSupplier . destroy ( ) ;
listSupplier = null ;
@ -132,7 +132,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -132,7 +132,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldReturnOnlyAliveService ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
@ -160,8 +160,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -160,8 +160,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNoEvent ( healthCheck . getInterval ( ) ) . thenCancel ( )
. verify ( VERIFY_TIMEOUT ) ;
@ -169,7 +168,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -169,7 +168,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldEmitOnEachAliveServiceInBatch ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
ServiceInstance serviceInstance2 = new DefaultServiceInstance ( "ignored-service-2" ,
@ -196,8 +195,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -196,8 +195,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNext ( Lists . list ( serviceInstance1 , serviceInstance2 ) )
. expectNoEvent ( healthCheck . getInterval ( ) ) . thenCancel ( )
@ -206,7 +204,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -206,7 +204,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldNotFailIfIsAliveReturnsError ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
ServiceInstance serviceInstance2 = new DefaultServiceInstance ( "ignored-service-2" ,
@ -234,8 +232,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -234,8 +232,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNoEvent ( healthCheck . getInterval ( ) ) . thenCancel ( )
. verify ( VERIFY_TIMEOUT ) ;
@ -243,7 +240,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -243,7 +240,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldEmitAllInstancesIfAllIsAliveChecksFailed ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
ServiceInstance serviceInstance2 = new DefaultServiceInstance ( "ignored-service-2" ,
@ -269,15 +266,14 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -269,15 +266,14 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( ) ) . expectNoEvent ( healthCheck . getInterval ( ) )
. thenCancel ( ) . verify ( VERIFY_TIMEOUT ) ;
}
@Test
void shouldMakeInitialDaleyAfterPropertiesSet ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
@ -298,8 +294,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -298,8 +294,7 @@ class HealthCheckServiceInstanceListSupplierTests {
listSupplier . afterPropertiesSet ( ) ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNoEvent ( healthCheck . getInterval ( ) ) . thenCancel ( )
. verify ( VERIFY_TIMEOUT ) ;
@ -307,7 +302,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -307,7 +302,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldRepeatIsAliveChecksIndefinitely ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
ServiceInstance serviceInstance2 = new DefaultServiceInstance ( "ignored-service-2" ,
@ -336,8 +331,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -336,8 +331,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( ) ) . expectNoEvent ( healthCheck . getInterval ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNoEvent ( healthCheck . getInterval ( ) )
@ -347,7 +341,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -347,7 +341,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldTimeoutIsAliveCheck ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
@ -372,8 +366,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -372,8 +366,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNoEvent ( healthCheck . getInterval ( ) ) . expectNext ( Lists . list ( ) )
. expectNoEvent ( healthCheck . getInterval ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
@ -384,7 +377,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -384,7 +377,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldUpdateInstances ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
ServiceInstance serviceInstance2 = new DefaultServiceInstance ( "ignored-service-2" ,
@ -409,8 +402,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -409,8 +402,7 @@ class HealthCheckServiceInstanceListSupplierTests {
} ;
return listSupplier . get ( ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. thenAwait ( healthCheck . getInterval ( ) . dividedBy ( 2 ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
@ -423,7 +415,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -423,7 +415,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@Test
void shouldCacheResultIfAfterPropertiesSetInvoked ( ) {
healthCheck . setInitialDelay ( 1000 ) ;
healthCheck . setInitialDelay ( Duration . ofSeconds ( 1 ) ) ;
ServiceInstance serviceInstance1 = new DefaultServiceInstance ( "ignored-service-1" ,
SERVICE_ID , "127.0.0.1" , port , false ) ;
@ -454,8 +446,7 @@ class HealthCheckServiceInstanceListSupplierTests {
@@ -454,8 +446,7 @@ class HealthCheckServiceInstanceListSupplierTests {
listSupplier . afterPropertiesSet ( ) ;
return listSupplier . get ( ) . take ( 1 ) . concatWith ( listSupplier . get ( ) . take ( 1 ) ) ;
} ) . expectSubscription ( )
. expectNoEvent ( Duration . ofMillis ( healthCheck . getInitialDelay ( ) ) )
} ) . expectSubscription ( ) . expectNoEvent ( healthCheck . getInitialDelay ( ) )
. expectNext ( Lists . list ( serviceInstance1 ) )
. expectNext ( Lists . list ( serviceInstance1 ) ) . thenCancel ( )
. verify ( VERIFY_TIMEOUT ) ;