Skip to content

Commit 475811b

Browse files
committed
debug(batch): add more detailed message to test assertion
1 parent 966dabc commit 475811b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/test/java/io/weaviate/client6/v1/api/collections/batch/BatchContextTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.util.concurrent.ArrayBlockingQueue;
1111
import java.util.concurrent.BlockingQueue;
1212
import java.util.concurrent.CompletableFuture;
13-
import java.util.concurrent.ExecutionException;
1413
import java.util.concurrent.ExecutorService;
1514
import java.util.concurrent.Executors;
1615
import java.util.concurrent.Future;
@@ -93,7 +92,7 @@ private StreamObserver<Message> createStream(StreamObserver<Event> recv) {
9392
* descriptor, and collection handle defaults.
9493
*/
9594
@Before
96-
public void setupContext() throws InterruptedException, ExecutionException {
95+
public void startContext() {
9796
context = new BatchContext.Builder<>(this::createStream, MAX_SIZE_BYTES, DESCRIPTOR, DEFAULTS)
9897
.batchSize(BATCH_SIZE)
9998
.queueSize(QUEUE_SIZE)
@@ -103,7 +102,7 @@ public void setupContext() throws InterruptedException, ExecutionException {
103102
}
104103

105104
@After
106-
public void closeContext() throws Exception {
105+
public void reset() throws Exception {
107106
if (context != null) {
108107
// Some of the tests may close the context, so this
109108
// implicitly tests that closing it multiple times is OK.
@@ -559,8 +558,10 @@ public void onError(Throwable t) {
559558

560559
@Override
561560
public void onNext(Message message) {
562-
boolean accepted = stream.offer(asRequest(message));
563-
assert accepted : "message rejected by the client stream";
561+
WeaviateProtoBatch.BatchStreamRequest req = asRequest(message);
562+
boolean accepted = stream.offer(req);
563+
assert accepted : "message %s delivered before %q was consumed".formatted(
564+
req.getMessageCase(), stream.peek().getMessageCase());
564565
}
565566

566567
private static WeaviateProtoBatch.BatchStreamRequest asRequest(Message message) {

0 commit comments

Comments
 (0)