File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
rsocket-core/src/test/java/io/rsocket/core
rsocket-test/src/main/java/io/rsocket/test Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1919import io .rsocket .transport .ServerTransport ;
2020import io .rsocket .util .DefaultPayload ;
2121import java .time .Duration ;
22- import org .junit .jupiter .api .Disabled ;
2322import org .junit .jupiter .api .Test ;
2423import reactor .core .publisher .Mono ;
2524import reactor .core .publisher .UnicastProcessor ;
@@ -47,7 +46,6 @@ void responderRejectSetup() {
4746 }
4847
4948 @ Test
50- @ Disabled ("FIXME: needs to be revised" )
5149 void requesterStreamsTerminatedOnZeroErrorFrame () {
5250 LeaksTrackingByteBufAllocator allocator =
5351 LeaksTrackingByteBufAllocator .instrument (ByteBufAllocator .DEFAULT );
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ public LeaksTrackingByteBufAllocator assertHasNoLeaks() {
6060
6161 final Duration awaitZeroRefCntDuration = this .awaitZeroRefCntDuration ;
6262 if (!unreleased .isEmpty () && !awaitZeroRefCntDuration .isZero ()) {
63- long endTimeInMillis = System .currentTimeMillis () + awaitZeroRefCntDuration .toMillis ();
63+ final long startTime = System .currentTimeMillis ();
64+ final long endTimeInMillis = startTime + awaitZeroRefCntDuration .toMillis ();
6465 boolean hasUnreleased ;
6566 while (System .currentTimeMillis () <= endTimeInMillis ) {
6667 hasUnreleased = false ;
@@ -72,14 +73,21 @@ public LeaksTrackingByteBufAllocator assertHasNoLeaks() {
7273 }
7374
7475 if (!hasUnreleased ) {
75- break ;
76+ System .out .println ("all the buffers are released..." );
77+ return this ;
7678 }
7779
78- parkNanos (100 );
80+ System .out .println ("await buffers to be released" );
81+ for (int i = 0 ; i < 100 ; i ++) {
82+ System .gc ();
83+ parkNanos (1000 );
84+ System .gc ();
85+ }
7986 }
8087 }
8188
8289 Assertions .assertThat (unreleased ).allMatch (bb -> bb .refCnt () == 0 );
90+ System .out .println ("all the buffers are released..." );
8391 } finally {
8492 tracker .clear ();
8593 }
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ default void setUp() {
101101 default void close () {
102102 getTransportPair ().responder .awaitAllInteractionTermination (getTimeout ());
103103 getTransportPair ().dispose ();
104+ getTransportPair ().awaitClosed ();
104105 getTransportPair ().byteBufAllocator .assertHasNoLeaks ();
105106 Hooks .resetOnOperatorDebug ();
106107 }
@@ -611,6 +612,10 @@ public String expectedPayloadMetadata() {
611612 return metadata ;
612613 }
613614
615+ public void awaitClosed () {
616+ server .onClose ().and (client .onClose ()).block (Duration .ofMinutes (1 ));
617+ }
618+
614619 private static class AsyncDuplexConnection implements DuplexConnection {
615620
616621 private final DuplexConnection duplexConnection ;
You can’t perform that action at this time.
0 commit comments