Skip to content

Commit a5c5ca2

Browse files
committed
test: Use list collections to check for auth instead of health check
Signed-off-by: Anush008 <anushshetty90@gmail.com>
1 parent 22c78dd commit a5c5ca2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/java/io/qdrant/client/ApiKeyTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import io.grpc.ManagedChannel;
1010
import io.grpc.Status;
1111
import io.grpc.StatusRuntimeException;
12-
import io.qdrant.client.grpc.QdrantOuterClass.HealthCheckReply;
13-
import io.qdrant.client.grpc.QdrantOuterClass.HealthCheckRequest;
12+
import io.qdrant.client.grpc.Collections.ListCollectionsRequest;
13+
import io.qdrant.client.grpc.Collections.ListCollectionsResponse;
1414
import java.util.concurrent.ExecutionException;
1515
import java.util.concurrent.TimeUnit;
1616
import org.junit.jupiter.api.AfterEach;
@@ -44,15 +44,14 @@ public void teardown() throws InterruptedException {
4444

4545
@Test
4646
public void client_with_api_key_can_connect() throws ExecutionException, InterruptedException {
47-
HealthCheckReply healthCheckReply;
47+
ListCollectionsResponse listCollectionsResponse;
4848
try (QdrantGrpcClient grpcClient =
4949
QdrantGrpcClient.newBuilder(channel).withApiKey("password!").build()) {
50-
healthCheckReply =
51-
grpcClient.qdrant().healthCheck(HealthCheckRequest.getDefaultInstance()).get();
50+
listCollectionsResponse =
51+
grpcClient.collections().list(ListCollectionsRequest.getDefaultInstance()).get();
5252
}
5353

54-
assertNotNull(healthCheckReply.getTitle());
55-
assertNotNull(healthCheckReply.getVersion());
54+
assertNotNull(listCollectionsResponse.getCollectionsList());
5655
}
5756

5857
@Test
@@ -61,7 +60,8 @@ public void client_without_api_key_cannot_connect() {
6160
ExecutionException executionException =
6261
assertThrows(
6362
ExecutionException.class,
64-
() -> grpcClient.qdrant().healthCheck(HealthCheckRequest.getDefaultInstance()).get());
63+
() ->
64+
grpcClient.collections().list(ListCollectionsRequest.getDefaultInstance()).get());
6565
Throwable cause = executionException.getCause();
6666
assertEquals(StatusRuntimeException.class, cause.getClass());
6767
StatusRuntimeException statusRuntimeException = (StatusRuntimeException) cause;

0 commit comments

Comments
 (0)