1616import static org .junit .jupiter .api .Assertions .assertThrows ;
1717import static org .junit .jupiter .api .Assertions .assertTrue ;
1818import static org .testcontainers .containers .utils .TarantoolContainerClientHelper .createTarantoolContainer ;
19+ import static org .testcontainers .containers .utils .TarantoolContainerClientHelper .execInitScript ;
1920import static org .testcontainers .containers .utils .TarantoolContainerClientHelper .executeCommandDecoded ;
2021import io .micrometer .core .instrument .MeterRegistry ;
2122import io .netty .util .HashedWheelTimer ;
4041import io .tarantool .pool .IProtoClientPoolImpl ;
4142import io .tarantool .pool .InstanceConnectionGroup ;
4243
43- @ Timeout (value = 15 )
44+ @ Timeout (value = 25 )
4445public class DistributingRoundRobinBalancerTest extends BaseTest {
4546
4647 private static final Logger log =
@@ -51,11 +52,14 @@ public class DistributingRoundRobinBalancerTest extends BaseTest {
5152
5253 @ BeforeEach
5354 public void setUp () {
54- tt1 = createTarantoolContainer ().withEnv (ENV_MAP ).withExposedPorts (3301 , 3305 );
55- tt2 = createTarantoolContainer ().withEnv (ENV_MAP ).withExposedPorts (3301 , 3305 );
55+ tt1 = createTarantoolContainer ().withEnv (ENV_MAP ).withExposedPorts (3305 );
56+ tt2 = createTarantoolContainer ().withEnv (ENV_MAP ).withExposedPorts (3305 );
5657
5758 tt1 .start ();
5859 tt2 .start ();
60+
61+ execInitScript (tt1 );
62+ execInitScript (tt2 );
5963 do {
6064 count1 = ThreadLocalRandom .current ().nextInt (MIN_CONNECTION_COUNT , MAX_CONNECTION_COUNT + 1 );
6165 count2 = ThreadLocalRandom .current ().nextInt (MIN_CONNECTION_COUNT , MAX_CONNECTION_COUNT + 1 );
@@ -178,8 +182,10 @@ public void testDistributingRoundRobinWithUnavailableNodeA() throws Exception {
178182 execLua (tt2 , "reset_call_counter()" );
179183
180184 log .info ("waiting for invalidation" );
181- Thread .sleep (INVALIDATION_TIMEOUT );
185+ Thread .sleep (EXTENDED_INVALIDATION_TIMEOUT );
182186
187+ execLua (tt1 , "reset_call_counter()" );
188+ execLua (tt2 , "reset_call_counter()" );
183189 log .info ("walk on node B only" );
184190 walkAndJoin (rrBalancer , nodeVisits * 2 );
185191 assertEquals (0 , getCallCounter (tt1 ));
@@ -235,8 +241,10 @@ public void testDistributingRoundRobinWithUnavailableNodeANoUnlock() throws Exce
235241 execLua (tt2 , "reset_call_counter()" );
236242
237243 log .info ("waiting for invalidation" );
238- Thread .sleep (INVALIDATION_TIMEOUT );
244+ Thread .sleep (EXTENDED_INVALIDATION_TIMEOUT );
239245
246+ execLua (tt1 , "reset_call_counter()" );
247+ execLua (tt2 , "reset_call_counter()" );
240248 log .info ("walk on node B only" );
241249 walkAndJoin (rrBalancer , nodeVisits * 2 );
242250 assertEquals (0 , getCallCounter (tt1 ));
@@ -290,7 +298,7 @@ public void testDistributingRoundRobinNoAvailableClients() throws Exception {
290298 execLua (tt2 , "lock_pipe(true); reset_call_counter()" );
291299
292300 log .info ("waiting for invalidation" );
293- Thread .sleep (INVALIDATION_TIMEOUT );
301+ Thread .sleep (EXTENDED_INVALIDATION_TIMEOUT );
294302
295303 Throwable exc = assertThrows (ExecutionException .class , () -> rrBalancer .getNext ().get ());
296304 assertEquals (NoAvailableClientsException .class , exc .getCause ().getClass ());
0 commit comments