File tree Expand file tree Collapse file tree
src/test/java/io/weaviate/client6/v1/api/collections/batch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import org .junit .After ;
2222import org .junit .AfterClass ;
2323import org .junit .Before ;
24+ import org .junit .Ignore ;
2425import org .junit .Test ;
2526
2627import io .grpc .stub .StreamObserver ;
@@ -109,7 +110,7 @@ public void startContext() throws InterruptedException {
109110
110111 @ After
111112 public void reset () throws Exception {
112- if (context != null && !contextClosed ) {
113+ if (!contextClosed ) {
113114 closeContext ();
114115 }
115116 context = null ;
@@ -136,9 +137,13 @@ private void closeContext() throws Exception {
136137 throw new RuntimeException (e );
137138 }
138139 }, BACKGROUND ).thenCompose (__ -> out .eof (true ));
139- context .close ();
140- eof .get ();
141- contextClosed = true ;
140+
141+ try {
142+ context .close ();
143+ eof .get ();
144+ } finally {
145+ contextClosed = true ;
146+ }
142147 }
143148
144149 @ Test
@@ -418,15 +423,15 @@ public void test_maxReconnectRetries() throws Exception {
418423 }
419424
420425 out .hangup ();
421- Assertions .assertThat (in .done ).completesExceptionallyWithin (5 , TimeUnit .SECONDS );
422-
423- Assertions .assertThatThrownBy (() -> context .close ())
426+
427+ try {
428+ this .closeContext ();
429+ }
430+ catch (Throwable t ) {
431+ Assertions .assertThat (t )
424432 .isInstanceOf (IOException .class )
425433 .hasMessageContaining ("Server unavailable" );
426-
427- // Cleanup: unset the context to prevent test teardown code
428- // from tripping on it while trying to close the context.
429- context = null ;
434+ }
430435 }
431436
432437 @ Test (expected = IllegalStateException .class )
You can’t perform that action at this time.
0 commit comments