|
13 | 13 | import org.assertj.core.api.InstanceOfAssertFactories; |
14 | 14 | import org.junit.BeforeClass; |
15 | 15 | import org.junit.ClassRule; |
| 16 | +import org.junit.Ignore; |
16 | 17 | import org.junit.Test; |
17 | 18 | import org.junit.rules.TestRule; |
18 | 19 |
|
@@ -667,4 +668,32 @@ public void testGenerative_bm25_groupBy() throws IOException { |
667 | 668 | .extracting(TaskOutput::text, InstanceOfAssertFactories.STRING) |
668 | 669 | .isNotBlank(); |
669 | 670 | } |
| 671 | + |
| 672 | + /** |
| 673 | + * Ensure the client respects server's configuration for max gRPC size: |
| 674 | + * we create a server with 1-byte message size and try to send a large payload |
| 675 | + * there. If the channel is configured correctly, it will refuse to send it. |
| 676 | + */ |
| 677 | + @Test |
| 678 | + @Ignore("Exception thrown by gRPC transport causes a deadlock") |
| 679 | + public void test_maxGrpcMessageSize() throws Exception { |
| 680 | + var w = Weaviate.custom().withGrpcMaxMessageSize(1).build(); |
| 681 | + var nsHugeVectors = ns("HugeVectors"); |
| 682 | + |
| 683 | + try (final var _client = w.getClient()) { |
| 684 | + var huge = _client.collections.create(nsHugeVectors, c -> c |
| 685 | + .vectorConfig(VectorConfig.selfProvided())); |
| 686 | + |
| 687 | + final var vector = randomVector(5000, -.01f, .01f); |
| 688 | + final WeaviateObject<Map<String, Object>, Reference, ObjectMetadata> hugeObject = WeaviateObject.of(obj -> obj |
| 689 | + .metadata(ObjectMetadata.of(m -> m |
| 690 | + .vectors(Vectors.of(vector))))); |
| 691 | + |
| 692 | + Assertions.assertThatThrownBy(() -> { |
| 693 | + // insertMany to route this request through gRPC. |
| 694 | + huge.data.insertMany(hugeObject); |
| 695 | + }).isInstanceOf(io.grpc.StatusRuntimeException.class); |
| 696 | + } |
| 697 | + System.out.println("here?"); |
| 698 | + } |
670 | 699 | } |
0 commit comments